cvs: php-src /ext/dom processinginstruction.c text.c xpath.c

From: Date: Sun, 15 Feb 2004 10:54:37 +0000
Subject: cvs: php-src /ext/dom processinginstruction.c text.c xpath.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-26199@lists.php.net to get a copy of this message
rrichards Sun Feb 15 05:54:37 2004 EDT Modified files: /php-src/ext/dom xpath.c text.c processinginstruction.c Log: start of dom update switch to zend_parse_method_parameters for consistancy insure object parameters are correct class types convert zvals to correct type if needed for property writes http://cvs.php.net/diff.php/php-src/ext/dom/xpath.c?r1=1.15&r2=1.16&ty=u Index: php-src/ext/dom/xpath.c diff -u php-src/ext/dom/xpath.c:1.15 php-src/ext/dom/xpath.c:1.16 --- php-src/ext/dom/xpath.c:1.15 Thu Jan 22 16:16:05 2004 +++ php-src/ext/dom/xpath.c Sun Feb 15 05:54:37 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xpath.c,v 1.15 2004/01/22 21:16:05 rrichards Exp $ */ +/* $Id: xpath.c,v 1.16 2004/02/15 10:54:37 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -49,7 +49,7 @@ dom_object *docobj, *intern; xmlXPathContextPtr ctx, oldctx; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo", &id, dom_xpath_class_entry, &doc) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &id, dom_xpath_class_entry, &doc, dom_document_class_entry) == FAILURE) { return; } @@ -106,7 +106,9 @@ dom_object *intern; unsigned char *prefix, *ns_uri; - DOM_GET_THIS(id); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { + return; + } intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); @@ -116,10 +118,6 @@ RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { - RETURN_FALSE; - } - if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) { RETURN_FALSE } @@ -149,7 +147,10 @@ xmlDoc *docp = NULL; xmlNsPtr *ns; - DOM_GET_THIS(id); + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) { + return; + } intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); @@ -165,10 +166,6 @@ RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|o", &expr, &expr_len, &context) == FAILURE) { - RETURN_FALSE; - } - if (context != NULL) { DOM_GET_OBJ(nodep, context, xmlNodePtr, nodeobj); } http://cvs.php.net/diff.php/php-src/ext/dom/text.c?r1=1.15&r2=1.16&ty=u Index: php-src/ext/dom/text.c diff -u php-src/ext/dom/text.c:1.15 php-src/ext/dom/text.c:1.16 --- php-src/ext/dom/text.c:1.15 Thu Jan 22 16:16:05 2004 +++ php-src/ext/dom/text.c Sun Feb 15 05:54:37 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: text.c,v 1.15 2004/01/22 21:16:05 rrichards Exp $ */ +/* $Id: text.c,v 1.16 2004/02/15 10:54:37 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -103,6 +103,7 @@ */ PHP_FUNCTION(dom_text_split_text) { + zval *id; xmlChar *cur; xmlChar *first; xmlChar *second; @@ -113,11 +114,10 @@ int length; dom_object *intern; - DOM_GET_THIS_OBJ(node, getThis(), xmlNodePtr, intern); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) { return; } + DOM_GET_OBJ(node, id, xmlNodePtr, intern); if (node->type != XML_TEXT_NODE) { RETURN_FALSE; @@ -162,12 +162,14 @@ */ PHP_FUNCTION(dom_text_is_whitespace_in_element_content) { + zval *id; xmlNodePtr node; dom_object *intern; - DOM_GET_THIS_OBJ(node, getThis(), xmlNodePtr, intern); - - DOM_NO_ARGS(); + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_text_class_entry) == FAILURE) { + return; + } + DOM_GET_OBJ(node, id, xmlNodePtr, intern); if (xmlIsBlankNode(node)) { RETURN_TRUE; http://cvs.php.net/diff.php/php-src/ext/dom/processinginstruction.c?r1=1.8&r2=1.9&ty=u Index: php-src/ext/dom/processinginstruction.c diff -u php-src/ext/dom/processinginstruction.c:1.8 php-src/ext/dom/processinginstruction.c:1.9 --- php-src/ext/dom/processinginstruction.c:1.8 Thu Jan 22 16:16:05 2004 +++ php-src/ext/dom/processinginstruction.c Sun Feb 15 05:54:37 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: processinginstruction.c,v 1.8 2004/01/22 21:16:05 rrichards Exp $ */ +/* $Id: processinginstruction.c,v 1.9 2004/02/15 10:54:37 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -124,11 +124,26 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC) { + zval value_copy; xmlNode *nodep; nodep = dom_object_get_node(obj); + + if (newval->type != IS_STRING) { + if(newval->refcount > 1) { + value_copy = *newval; + zval_copy_ctor(&value_copy); + newval = &value_copy; + } + convert_to_string(newval); + } + xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1); + if (newval == &value_copy) { + zval_dtor(newval); + } + return SUCCESS; }

« previous php.cvs (#26199) next »