diff options
Diffstat (limited to 'ext/xml/xml.c')
-rw-r--r-- | ext/xml/xml.c | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/ext/xml/xml.c b/ext/xml/xml.c index aabb414157..c08e3818d5 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -111,7 +111,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_object, 0, 0, 2) ZEND_ARG_INFO(0, parser) - ZEND_ARG_INFO(1, obj) + ZEND_ARG_INFO(0, obj) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_element_handler, 0, 0, 3) @@ -286,7 +286,7 @@ xml_encoding xml_encodings[] = { static XML_Memory_Handling_Suite php_xml_mem_hdlrs; /* True globals, no need for thread safety */ -static int le_xml_parser; +static int le_xml_parser; /* }}} */ @@ -349,7 +349,7 @@ PHP_MINIT_FUNCTION(xml) REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); /* this object should not be pre-initialised at compile time, - as the order of members may vary */ + as the order of members may vary */ php_xml_mem_hdlrs.malloc_fcn = php_xml_malloc_wrapper; php_xml_mem_hdlrs.realloc_fcn = php_xml_realloc_wrapper; @@ -397,7 +397,7 @@ static void _xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encodi static void xml_parser_dtor(zend_resource *rsrc) { xml_parser *parser = (xml_parser *)rsrc->ptr; - + if (parser->parser) { XML_ParserFree(parser->parser); } @@ -483,9 +483,7 @@ static void xml_call_handler(xml_parser *parser, zval *handler, zend_function *f zend_fcall_info fci; fci.size = sizeof(fci); - fci.function_table = EG(function_table); ZVAL_COPY_VALUE(&fci.function_name, handler); - fci.symbol_table = NULL; fci.object = Z_OBJ(parser->object); fci.retval = retval; fci.param_count = argc; @@ -641,7 +639,7 @@ PHP_XML_API zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XM c = '?'; } - ZSTR_VAL(str)[ZSTR_LEN(str)++] = decoder ? decoder(c) : c; + ZSTR_VAL(str)[ZSTR_LEN(str)++] = decoder ? (unsigned int)decoder(c) : c; } ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0'; if (ZSTR_LEN(str) < len) { @@ -867,7 +865,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } if (!Z_ISUNDEF(parser->data)) { - int i; + size_t i; int doprint = 0; zend_string *decoded_value; @@ -900,7 +898,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } else { add_assoc_str(parser->ctag, "value", decoded_value); } - + } else { zval tag; zval *curtag, *mytype, *myval; @@ -978,8 +976,8 @@ void _xml_defaultHandler(void *userData, const XML_Char *s, int len) /* }}} */ /* {{{ _xml_unparsedEntityDeclHandler() */ -void _xml_unparsedEntityDeclHandler(void *userData, - const XML_Char *entityName, +void _xml_unparsedEntityDeclHandler(void *userData, + const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, @@ -1147,15 +1145,15 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp } /* }}} */ -/* {{{ proto resource xml_parser_create([string encoding]) +/* {{{ proto resource xml_parser_create([string encoding]) Create an XML parser */ PHP_FUNCTION(xml_parser_create) { - php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); + php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]]) +/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]]) Create an XML parser */ PHP_FUNCTION(xml_parser_create_ns) { @@ -1163,14 +1161,14 @@ PHP_FUNCTION(xml_parser_create_ns) } /* }}} */ -/* {{{ proto int xml_set_object(resource parser, object &obj) +/* {{{ proto int xml_set_object(resource parser, object &obj) Set up object which should be used for callbacks */ PHP_FUNCTION(xml_set_object) { xml_parser *parser; zval *pind, *mythis; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro/", &pind, &mythis) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro", &pind, &mythis) == FAILURE) { return; } @@ -1184,9 +1182,7 @@ PHP_FUNCTION(xml_set_object) } /* please leave this commented - or ask thies@thieso.net before doing it (again) */ -/* #ifdef ZEND_ENGINE_2 - zval_add_ref(&parser->object); -#endif */ + /* zval_add_ref(&parser->object); */ ZVAL_COPY(&parser->object, mythis); @@ -1194,7 +1190,7 @@ PHP_FUNCTION(xml_set_object) } /* }}} */ -/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl) +/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl) Set up start and end element handlers */ PHP_FUNCTION(xml_set_element_handler) { @@ -1216,7 +1212,7 @@ PHP_FUNCTION(xml_set_element_handler) } /* }}} */ -/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl) +/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl) Set up character data handler */ PHP_FUNCTION(xml_set_character_data_handler) { @@ -1237,7 +1233,7 @@ PHP_FUNCTION(xml_set_character_data_handler) } /* }}} */ -/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl) +/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl) Set up processing instruction (PI) handler */ PHP_FUNCTION(xml_set_processing_instruction_handler) { @@ -1258,7 +1254,7 @@ PHP_FUNCTION(xml_set_processing_instruction_handler) } /* }}} */ -/* {{{ proto int xml_set_default_handler(resource parser, string hdl) +/* {{{ proto int xml_set_default_handler(resource parser, string hdl) Set up default handler */ PHP_FUNCTION(xml_set_default_handler) { @@ -1279,7 +1275,7 @@ PHP_FUNCTION(xml_set_default_handler) } /* }}} */ -/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl) +/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl) Set up unparsed entity declaration handler */ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler) { @@ -1300,7 +1296,7 @@ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler) } /* }}} */ -/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl) +/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl) Set up notation declaration handler */ PHP_FUNCTION(xml_set_notation_decl_handler) { @@ -1321,7 +1317,7 @@ PHP_FUNCTION(xml_set_notation_decl_handler) } /* }}} */ -/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl) +/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl) Set up external entity reference handler */ PHP_FUNCTION(xml_set_external_entity_ref_handler) { @@ -1342,7 +1338,7 @@ PHP_FUNCTION(xml_set_external_entity_ref_handler) } /* }}} */ -/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl) +/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl) Set up character data handler */ PHP_FUNCTION(xml_set_start_namespace_decl_handler) { @@ -1363,7 +1359,7 @@ PHP_FUNCTION(xml_set_start_namespace_decl_handler) } /* }}} */ -/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl) +/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl) Set up character data handler */ PHP_FUNCTION(xml_set_end_namespace_decl_handler) { @@ -1443,7 +1439,7 @@ PHP_FUNCTION(xml_parse_into_struct) if (info) { ZVAL_COPY_VALUE(&parser->info, info); } - + parser->level = 0; parser->ltags = safe_emalloc(XML_MAXLEVEL, sizeof(char *), 0); @@ -1459,7 +1455,7 @@ PHP_FUNCTION(xml_parse_into_struct) } /* }}} */ -/* {{{ proto int xml_get_error_code(resource parser) +/* {{{ proto int xml_get_error_code(resource parser) Get XML parser error code */ PHP_FUNCTION(xml_get_error_code) { @@ -1496,7 +1492,7 @@ PHP_FUNCTION(xml_error_string) } /* }}} */ -/* {{{ proto int xml_get_current_line_number(resource parser) +/* {{{ proto int xml_get_current_line_number(resource parser) Get current line number for an XML parser */ PHP_FUNCTION(xml_get_current_line_number) { @@ -1534,7 +1530,7 @@ PHP_FUNCTION(xml_get_current_column_number) } /* }}} */ -/* {{{ proto int xml_get_current_byte_index(resource parser) +/* {{{ proto int xml_get_current_byte_index(resource parser) Get current byte index for an XML parser */ PHP_FUNCTION(xml_get_current_byte_index) { @@ -1553,13 +1549,12 @@ PHP_FUNCTION(xml_get_current_byte_index) } /* }}} */ -/* {{{ proto int xml_parser_free(resource parser) +/* {{{ proto int xml_parser_free(resource parser) Free an XML parser */ PHP_FUNCTION(xml_parser_free) { zval *pind; xml_parser *parser; - zend_resource *res; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) { return; @@ -1582,7 +1577,7 @@ PHP_FUNCTION(xml_parser_free) } /* }}} */ -/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value) +/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value) Set options in an XML parser */ PHP_FUNCTION(xml_parser_set_option) { @@ -1631,7 +1626,7 @@ PHP_FUNCTION(xml_parser_set_option) } /* }}} */ -/* {{{ proto int xml_parser_get_option(resource parser, int option) +/* {{{ proto int xml_parser_get_option(resource parser, int option) Get options from an XML parser */ PHP_FUNCTION(xml_parser_get_option) { @@ -1664,7 +1659,7 @@ PHP_FUNCTION(xml_parser_get_option) } /* }}} */ -/* {{{ proto string utf8_encode(string data) +/* {{{ proto string utf8_encode(string data) Encodes an ISO-8859-1 string to UTF-8 */ PHP_FUNCTION(utf8_encode) { @@ -1684,7 +1679,7 @@ PHP_FUNCTION(utf8_encode) } /* }}} */ -/* {{{ proto string utf8_decode(string data) +/* {{{ proto string utf8_decode(string data) Converts a UTF-8 encoded string to ISO-8859-1 */ PHP_FUNCTION(utf8_decode) { |