Skip to content

Commit 168ea67

Browse files
committed
ported xsl, xml reader and writer
1 parent acdda10 commit 168ea67

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

ext/xmlreader/php_xmlreader.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,11 @@ Get value of an attribute at index from current element */
561561
PHP_METHOD(xmlreader, getAttributeNo)
562562
{
563563
zval *id;
564-
long attr_pos;
564+
php_int_t attr_pos;
565565
char *retchar = NULL;
566566
xmlreader_object *intern;
567567

568-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
568+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
569569
return;
570570
}
571571

@@ -618,11 +618,11 @@ Indicates whether given property (one of the parser option constants) is set or
618618
PHP_METHOD(xmlreader, getParserProperty)
619619
{
620620
zval *id;
621-
long property;
621+
php_int_t property;
622622
int retval = -1;
623623
xmlreader_object *intern;
624624

625-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) {
625+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &property) == FAILURE) {
626626
return;
627627
}
628628

@@ -697,11 +697,11 @@ Returns TRUE on success and FALSE on failure */
697697
PHP_METHOD(xmlreader, moveToAttributeNo)
698698
{
699699
zval *id;
700-
long attr_pos;
700+
php_int_t attr_pos;
701701
int retval;
702702
xmlreader_object *intern;
703703

704-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
704+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) {
705705
return;
706706
}
707707

@@ -847,14 +847,14 @@ PHP_METHOD(xmlreader, open)
847847
{
848848
zval *id;
849849
int source_len = 0, encoding_len = 0;
850-
long options = 0;
850+
php_int_t options = 0;
851851
xmlreader_object *intern = NULL;
852852
char *source, *valid_file = NULL;
853853
char *encoding = NULL;
854854
char resolved_path[MAXPATHLEN + 1];
855855
xmlTextReaderPtr reader = NULL;
856856

857-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
857+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
858858
return;
859859
}
860860

@@ -978,12 +978,12 @@ Properties must be set after open() or XML() and before the first read() is call
978978
PHP_METHOD(xmlreader, setParserProperty)
979979
{
980980
zval *id;
981-
long property;
981+
php_int_t property;
982982
int retval = -1;
983983
zend_bool value;
984984
xmlreader_object *intern;
985985

986-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) {
986+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &property, &value) == FAILURE) {
987987
return;
988988
}
989989

@@ -1030,15 +1030,15 @@ PHP_METHOD(xmlreader, XML)
10301030
{
10311031
zval *id;
10321032
int source_len = 0, encoding_len = 0;
1033-
long options = 0;
1033+
php_int_t options = 0;
10341034
xmlreader_object *intern = NULL;
10351035
char *source, *uri = NULL, *encoding = NULL;
10361036
int resolved_path_len, ret = 0;
10371037
char *directory=NULL, resolved_path[MAXPATHLEN];
10381038
xmlParserInputBufferPtr inputbfr;
10391039
xmlTextReaderPtr reader;
10401040

1041-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
1041+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
10421042
return;
10431043
}
10441044

ext/xmlwriter/php_xmlwriter.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
635635
dir_len = php_dirname(file_dirname, strlen(source));
636636

637637
if (dir_len > 0) {
638-
struct stat buf;
638+
php_stat_t buf;
639639
if (php_sys_stat(file_dirname, &buf) != 0) {
640640
xmlFreeURI(uri);
641641
return NULL;

ext/xsl/php_xsl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ typedef struct _xsl_object {
6464
HashTable *node_list;
6565
php_libxml_node_object *doc;
6666
char *profiling;
67-
long securityPrefs;
67+
php_int_t securityPrefs;
6868
int securityPrefsSet;
6969
zend_object std;
7070
} xsl_object;

ext/xsl/xsltprocessor.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
138138
zval *value;
139139
char *xpath_expr;
140140
zend_string *string_key;
141-
ulong num_key;
141+
php_uint_t num_key;
142142
char **params = NULL;
143143
int i = 0;
144144

@@ -292,7 +292,11 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
292292

293293
fci.size = sizeof(fci);
294294
fci.function_table = EG(function_table);
295-
fci.params = args;
295+
if (fci.param_count > 0) {
296+
fci.params = args;
297+
} else {
298+
fci.params = NULL;
299+
}
296300

297301
obj = valuePop(ctxt);
298302
if (obj->stringval == NULL) {
@@ -760,7 +764,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
760764
zval *id;
761765
zval *array_value, *entry, new_string;
762766
xsl_object *intern;
763-
ulong idx;
767+
php_uint_t idx;
764768
char *namespace;
765769
int namespace_len;
766770
zend_string *string_key, *name, *value;
@@ -914,10 +918,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
914918
{
915919
zval *id;
916920
xsl_object *intern;
917-
long securityPrefs, oldSecurityPrefs;
921+
php_int_t securityPrefs, oldSecurityPrefs;
918922

919923
DOM_GET_THIS(id);
920-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) {
924+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &securityPrefs) == FAILURE) {
921925
return;
922926
}
923927
intern = Z_XSL_P(id);

0 commit comments

Comments
 (0)