1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ported xsl, xml reader and writer

This commit is contained in:
Anatol Belski
2014-08-19 12:55:03 +02:00
parent acdda1093b
commit 168ea67b2d
4 changed files with 23 additions and 19 deletions

View File

@@ -561,11 +561,11 @@ Get value of an attribute at index from current element */
PHP_METHOD(xmlreader, getAttributeNo)
{
zval *id;
long attr_pos;
php_int_t attr_pos;
char *retchar = NULL;
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
return;
}
@@ -618,11 +618,11 @@ Indicates whether given property (one of the parser option constants) is set or
PHP_METHOD(xmlreader, getParserProperty)
{
zval *id;
long property;
php_int_t property;
int retval = -1;
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &property) == FAILURE) {
return;
}
@@ -697,11 +697,11 @@ Returns TRUE on success and FALSE on failure */
PHP_METHOD(xmlreader, moveToAttributeNo)
{
zval *id;
long attr_pos;
php_int_t attr_pos;
int retval;
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
return;
}
@@ -847,14 +847,14 @@ PHP_METHOD(xmlreader, open)
{
zval *id;
int source_len = 0, encoding_len = 0;
long options = 0;
php_int_t options = 0;
xmlreader_object *intern = NULL;
char *source, *valid_file = NULL;
char *encoding = NULL;
char resolved_path[MAXPATHLEN + 1];
xmlTextReaderPtr reader = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
return;
}
@@ -978,12 +978,12 @@ Properties must be set after open() or XML() and before the first read() is call
PHP_METHOD(xmlreader, setParserProperty)
{
zval *id;
long property;
php_int_t property;
int retval = -1;
zend_bool value;
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &property, &value) == FAILURE) {
return;
}
@@ -1030,7 +1030,7 @@ PHP_METHOD(xmlreader, XML)
{
zval *id;
int source_len = 0, encoding_len = 0;
long options = 0;
php_int_t options = 0;
xmlreader_object *intern = NULL;
char *source, *uri = NULL, *encoding = NULL;
int resolved_path_len, ret = 0;
@@ -1038,7 +1038,7 @@ PHP_METHOD(xmlreader, XML)
xmlParserInputBufferPtr inputbfr;
xmlTextReaderPtr reader;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
return;
}

View File

@@ -635,7 +635,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
dir_len = php_dirname(file_dirname, strlen(source));
if (dir_len > 0) {
struct stat buf;
php_stat_t buf;
if (php_sys_stat(file_dirname, &buf) != 0) {
xmlFreeURI(uri);
return NULL;

View File

@@ -64,7 +64,7 @@ typedef struct _xsl_object {
HashTable *node_list;
php_libxml_node_object *doc;
char *profiling;
long securityPrefs;
php_int_t securityPrefs;
int securityPrefsSet;
zend_object std;
} xsl_object;

View File

@@ -138,7 +138,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
zval *value;
char *xpath_expr;
zend_string *string_key;
ulong num_key;
php_uint_t num_key;
char **params = NULL;
int i = 0;
@@ -292,7 +292,11 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
fci.size = sizeof(fci);
fci.function_table = EG(function_table);
fci.params = args;
if (fci.param_count > 0) {
fci.params = args;
} else {
fci.params = NULL;
}
obj = valuePop(ctxt);
if (obj->stringval == NULL) {
@@ -760,7 +764,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
zval *id;
zval *array_value, *entry, new_string;
xsl_object *intern;
ulong idx;
php_uint_t idx;
char *namespace;
int namespace_len;
zend_string *string_key, *name, *value;
@@ -914,10 +918,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
{
zval *id;
xsl_object *intern;
long securityPrefs, oldSecurityPrefs;
php_int_t securityPrefs, oldSecurityPrefs;
DOM_GET_THIS(id);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &securityPrefs) == FAILURE) {
return;
}
intern = Z_XSL_P(id);