[PHP-CVS] cvs: php4 /ext/xslt sablot.c

2002-11-02 Thread Melvyn Sopacua
msopacuaSat Nov  2 10:01:43 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c 
  Log:
  - Use spprintf to avoid two calls to zend_get_executed_filename, suggested
by Marcus Börger
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.66 php4/ext/xslt/sablot.c:1.67
--- php4/ext/xslt/sablot.c:1.66 Sat Nov  2 05:58:01 2002
+++ php4/ext/xslt/sablot.c  Sat Nov  2 10:01:42 2002
 -19,7 +19,7 
+--+
  */
 
-/* $Id: sablot.c,v 1.66 2002/11/02 10:58:01 helly Exp $ */
+/* $Id: sablot.c,v 1.67 2002/11/02 15:01:42 msopacua Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 -554,8 +554,7 
/* Since we have args passed, we need to set the base uri, so 
pull in executor
globals and set the base, using the current filename, 
specifally for the
'arg' scheme */
-   baseuri = (char 
*)emalloc(strlen(zend_get_executed_filename(TSRMLS_C))+7+1);
-   sprintf(baseuri, file://%s, 
zend_get_executed_filename(TSRMLS_C));
+   spprintf(baseuri, 0, file://%s, 
+zend_get_executed_filename(TSRMLS_C));
 
SablotSetBaseForScheme(XSLT_PROCESSOR(handle), arg, baseuri);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/xslt sablot.c

2002-11-01 Thread Lenar Lõhmus
flexFri Nov  1 09:44:05 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c 
  Log:
  
  Fix scheme_getall() function so that data returned by user is always
  converted to string except when script returns FALSE or NULL. In this case
  signal sablotron that we are not able to handle requested scheme.
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.62 php4/ext/xslt/sablot.c:1.63
--- php4/ext/xslt/sablot.c:1.62 Thu Oct 31 21:05:35 2002
+++ php4/ext/xslt/sablot.c  Fri Nov  1 09:44:05 2002
 -16,7 +16,7 
+--+
  */
 
-/* $Id: sablot.c,v 1.62 2002/11/01 02:05:35 msopacua Exp $ */
+/* $Id: sablot.c,v 1.63 2002/11/01 14:44:05 flex Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 -853,6 +853,7 
 {
zval   *argv[3];   /* Arguments to the scheme 
getall function */
zval   *retval;/* Return value from the scheme 
getall function */
+   intresult;
php_xslt   *handle = (php_xslt *) user_data;   /* A PHP-XSLT processor */
 TSRMLS_FETCH();
 
 -883,16 +884,24 
/* return failure */
return 1;
}
-   
-   /* Save the return value in the buffer (copying it) */
-   *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
-   *byte_count = Z_STRLEN_P(retval);
+
+   if ((Z_TYPE_P(retval) == IS_BOOL  Z_LVAL_P(retval) == 0) || 
+(Z_TYPE_P(retval) == IS_NULL)) {
+   result = 1;
+   } else {
+   /* Convert the return value to string if needed */
+   if (Z_TYPE_P(retval) != IS_STRING)
+   convert_to_string_ex(retval);
+
+   /* Save the return value in the buffer (copying it) */
+   *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
+   *byte_count = Z_STRLEN_P(retval);
+   result = 0;
+   }
 
/* Free return value */
zval_ptr_dtor(retval);

-   /* return success */
-   return 0;
+   return result;
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/xslt sablot.c

2002-11-01 Thread Melvyn Sopacua
msopacuaFri Nov  1 20:44:35 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c 
  Log:
  Fix typo
  # Sorry Lenar
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.64 php4/ext/xslt/sablot.c:1.65
--- php4/ext/xslt/sablot.c:1.64 Fri Nov  1 20:32:08 2002
+++ php4/ext/xslt/sablot.c  Fri Nov  1 20:44:34 2002
@@ -14,12 +14,12 @@
+--+
| Authors: Sterling Hughes [EMAIL PROTECTED]  |
|  David Viner [EMAIL PROTECTED]|
-   |  Lehnar Lohmus [EMAIL PROTECTED]|
+   |  Lenar Lohmus [EMAIL PROTECTED] |
|  Melvyn Sopacua [EMAIL PROTECTED]   |
+--+
  */
 
-/* $Id: sablot.c,v 1.64 2002/11/02 01:32:08 msopacua Exp $ */
+/* $Id: sablot.c,v 1.65 2002/11/02 01:44:34 msopacua Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/xslt sablot.c

2002-10-31 Thread Melvyn Sopacua
msopacuaThu Oct 31 21:05:36 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c 
  Log:
  - Fix registration of XSLT_SABOPT_FILES_TO_HANDLER
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.61 php4/ext/xslt/sablot.c:1.62
--- php4/ext/xslt/sablot.c:1.61 Thu Oct 31 16:21:00 2002
+++ php4/ext/xslt/sablot.c  Thu Oct 31 21:05:35 2002
 -16,7 +16,7 
+--+
  */
 
-/* $Id: sablot.c,v 1.61 2002/10/31 21:21:00 msopacua Exp $ */
+/* $Id: sablot.c,v 1.62 2002/11/01 02:05:35 msopacua Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 -170,7 +170,9 
REGISTER_LONG_CONSTANT(XSLT_SABOPT_DISABLE_ADDING_META, 
SAB_DISABLE_ADDING_META, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(XSLT_SABOPT_DISABLE_STRIPPING, SAB_DISABLE_STRIPPING, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(XSLT_SABOPT_IGNORE_DOC_NOT_FOUND, 
SAB_IGNORE_DOC_NOT_FOUND, CONST_CS | CONST_PERSISTENT);
-#ifdef SAB_FILES_TO_HANDLER
+/* hack: implemented at the same time, so should work.
+   Otherwise we need to check the enum type of SablotFlag in sablot.h */
+#ifdef HAVE_SABLOT_GET_OPTIONS
REGISTER_LONG_CONSTANT(XSLT_SABOPT_FILES_TO_HANDLER, SAB_FILES_TO_HANDLER, 
CONST_CS | CONST_PERSISTENT);
 #endif
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/xslt sablot.c xslt.c

2002-10-30 Thread Marcus Börger
helly   Wed Oct 30 09:15:16 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c xslt.c 
  Log:
  php_error - php_error_docref
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.59 php4/ext/xslt/sablot.c:1.60
--- php4/ext/xslt/sablot.c:1.59 Fri Oct 25 15:23:13 2002
+++ php4/ext/xslt/sablot.c  Wed Oct 30 09:15:15 2002
 -16,7 +16,7 
+--+
  */
 
-/* $Id: sablot.c,v 1.59 2002/10/25 19:23:13 msopacua Exp $ */
+/* $Id: sablot.c,v 1.60 2002/10/30 14:15:15 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 -38,7 +38,7 
 #include fcntl.h
 
 /* functions relating to handlers */
-static void register_sax_handler_pair(zval **, zval **, zval **);
+static void register_sax_handler_pair(zval **, zval **, zval ** TSRMLS_DC);
 
 /* Free processor */
 static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
 -248,7 +248,7 
/* Convert the sax_handlers_p zval ** to a hash table we can process */
sax_handlers = HASH_OF(*sax_handlers_p);
if (!sax_handlers) {
-   php_error(E_WARNING, Expecting an array as the second argument to 
xslt_set_sax_handlers());
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Expecting an array as the 
+second argument);
return;
}
 
 -260,7 +260,7 
key_type = zend_hash_get_current_key(sax_handlers, string_key, 
num_key, 0);
if (key_type == HASH_KEY_IS_LONG) {
convert_to_string_ex(handler);
-   php_error(E_NOTICE, Skipping numerical index %d (with value 
%s) in xslt_set_sax_handlers(),
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Skipping numerical 
+index %d (with value %s),
  num_key, Z_STRVAL_PP(handler));
continue;
}
 -270,21 +270,21 
SEPARATE_ZVAL(handler);
register_sax_handler_pair(XSLT_SAX(handle).doc_start, 
  XSLT_SAX(handle).doc_end, 
- handler);
+ handler TSRMLS_CC);
}
/* Element handlers, start of an element, and end of an element */
else if (strcasecmp(string_key, element) == 0) {
SEPARATE_ZVAL(handler);
register_sax_handler_pair(XSLT_SAX(handle).element_start, 
  XSLT_SAX(handle).element_end, 
- handler);
+ handler TSRMLS_CC);
}
/* Namespace handlers, start of a namespace, end of a namespace */
else if (strcasecmp(string_key, namespace) == 0) {
SEPARATE_ZVAL(handler);
register_sax_handler_pair(XSLT_SAX(handle).namespace_start, 
  XSLT_SAX(handle).namespace_end, 
- handler);
+ handler TSRMLS_CC);
}
/* Comment handlers, called when a comment is reached */
else if (strcasecmp(string_key, comment) == 0) {
 -304,7 +304,7 
}
/* Invalid handler name, tsk, tsk, tsk :) */
else {
-   php_error(E_WARNING, Invalid option to 
xslt_set_sax_handlers(): %s, string_key);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option: 
+%s, string_key);
}
}
 }
 -332,7 +332,7 
 
scheme_handlers = HASH_OF(*scheme_handlers_p);
if (!scheme_handlers) {
-   php_error(E_WARNING, 2nd argument to xslt_set_scheme_handlers() must 
be an array);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 2nd argument must be an 
+array);
return;
}
 
 -344,7 +344,7 
 
key_type = zend_hash_get_current_key(scheme_handlers, string_key, 
num_key, 0);
if (key_type == HASH_KEY_IS_LONG) {
-   php_error(E_NOTICE, Numerical key %d (with value %s) being 
ignored in xslt_set_scheme_handlers(),
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Numerical key %d 
+(with value %s) being ignored,
  num_key, Z_STRVAL_PP(handler));
continue;
}
 -371,7 +371,7 
}
/* Invalid handler name */
else {
-   php_error(E_WARNING, %s() invalid option '%s', skipping, 
get_active_function_name(TSRMLS_C), string_key);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 

[PHP-CVS] cvs: php4 /ext/xslt sablot.c

2002-10-05 Thread Melvyn Sopacua

msopacuaSat Oct  5 10:04:18 2002 EDT

  Modified files:  
/php4/ext/xslt  sablot.c 
  Log:
  (xslt: error_print) Fixes a leak when multiple error messages are issued
  during a transformation.
  # It's probably better to wrap this in an internal function, since it's
  # easily forgotten.
  
  
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.55 php4/ext/xslt/sablot.c:1.56
--- php4/ext/xslt/sablot.c:1.55 Fri Oct  4 19:06:09 2002
+++ php4/ext/xslt/sablot.c  Sat Oct  5 10:04:18 2002
 -16,7 +16,7 
+--+
  */
 
-/* $Id: sablot.c,v 1.55 2002/10/04 23:06:09 dviner Exp $ */
+/* $Id: sablot.c,v 1.56 2002/10/05 14:04:18 msopacua Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
 -1632,6 +1632,10 
/* Allocate the message buffer and copy the data onto it */
msgbuf = emalloc((sizeof(msgformat) - 4) + strlen(errmsg) + 
strlen(errline) + 1);
sprintf(msgbuf, msgformat, errline, errmsg);
+
+   /* If an old message exists, remove it - leak */
+   if (XSLT_ERRSTR(handle))
+   efree(XSLT_ERRSTR(handle));
 
/* Copy the error message onto the handle for use when 
   the xslt_error function is called */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php