[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2009-01-06 Thread Ilia Alshanetsky
iliaa   Tue Jan  6 23:46:22 2009 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  
  MFB: Arg parsing cleanup
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.129r2=1.130diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.129 php-src/ext/tidy/tidy.c:1.130
--- php-src/ext/tidy/tidy.c:1.129   Wed Dec 31 11:12:37 2008
+++ php-src/ext/tidy/tidy.c Tue Jan  6 23:46:22 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.129 2008/12/31 11:12:37 sebastian Exp $ */
+/* $Id: tidy.c,v 1.130 2009/01/06 23:46:22 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -562,7 +562,7 @@
zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
-   zval **config;
+   zval **config = NULL;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|Zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
@@ -593,7 +593,7 @@

TIDY_SET_DEFAULT_CONFIG(doc);
 
-   if (ZEND_NUM_ARGS()  1) {
+   if (config) {
TIDY_APPLY_CONFIG_ZVAL(doc, config);
}
 
@@ -1156,7 +1156,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.129 2008/12/31 11:12:37 sebastian 
Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.130 2009/01/06 23:46:22 iliaa Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();



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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2008-12-27 Thread Antony Dovgal
tony2001Sat Dec 27 20:23:05 2008 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  lost part of the fix
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.127r2=1.128diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.127 php-src/ext/tidy/tidy.c:1.128
--- php-src/ext/tidy/tidy.c:1.127   Sat Dec 27 20:21:57 2008
+++ php-src/ext/tidy/tidy.c Sat Dec 27 20:23:05 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.127 2008/12/27 20:21:57 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.128 2008/12/27 20:23:05 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -213,8 +213,8 @@
 static void tidy_object_free_storage(void * TSRMLS_DC);
 static zend_object_value tidy_object_new_node(zend_class_entry * TSRMLS_DC);
 static zend_object_value tidy_object_new_doc(zend_class_entry * TSRMLS_DC);
-static zend_class_entry *tidy_get_ce_node(zval * TSRMLS_DC);
-static zend_class_entry *tidy_get_ce_doc(zval * TSRMLS_DC);
+static zend_class_entry *tidy_get_ce_node(const zval * TSRMLS_DC);
+static zend_class_entry *tidy_get_ce_doc(const zval * TSRMLS_DC);
 static zval * tidy_instanciate(zend_class_entry *, zval * TSRMLS_DC);
 static int tidy_doc_cast_handler(zval *, zval *, int, void * TSRMLS_DC);
 static int tidy_node_cast_handler(zval *, zval *, int, void * TSRMLS_DC);
@@ -1156,7 +1156,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.127 2008/12/27 20:21:57 tony2001 Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.128 2008/12/27 20:23:05 tony2001 Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();



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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2008-08-29 Thread Henrique do Nascimento Angelo
hnangeloFri Aug 29 22:59:42 2008 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fix wrong Unicode string length (bytes) in tidy_parse_string()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.122r2=1.123diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.122 php-src/ext/tidy/tidy.c:1.123
--- php-src/ext/tidy/tidy.c:1.122   Thu Jul  3 12:21:25 2008
+++ php-src/ext/tidy/tidy.c Fri Aug 29 22:59:41 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.122 2008/07/03 12:21:25 felipe Exp $ */
+/* $Id: tidy.c,v 1.123 2008/08/29 22:59:41 hnangelo Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1180,7 +1180,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.122 2008/07/03 12:21:25 felipe Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.123 2008/08/29 22:59:41 hnangelo Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1313,7 +1313,7 @@
 
TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
 
-   if (php_tidy_parse_string(obj, input.s, input_len, enc TSRMLS_CC) == 
FAILURE) {
+   if (php_tidy_parse_string(obj, input.s, USTR_BYTES(input_type, 
input_len), enc TSRMLS_CC) == FAILURE) {
zval_dtor(return_value);
INIT_ZVAL(*return_value);
RETVAL_FALSE;



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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 029.phpt

2007-09-20 Thread Nuno Lopes
nlopess Thu Sep 20 22:30:49 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 029.phpt 
  Log:
  MFB: fix crash in tidy_get_body() and related functions when the node doesnt 
exist
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.113r2=1.114diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.113 php-src/ext/tidy/tidy.c:1.114
--- php-src/ext/tidy/tidy.c:1.113   Fri May  4 17:45:56 2007
+++ php-src/ext/tidy/tidy.c Thu Sep 20 22:30:48 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp $ */
+/* $Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -902,37 +902,42 @@
return NULL;
 }
 
-static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node)
+static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node_type)
 {
PHPTidyObj *newobj;
+   TidyNode node;
TIDY_FETCH_OBJECT;
 
-   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
-   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
-   newobj-type = is_node;
-   newobj-ptdoc = obj-ptdoc;
-   newobj-ptdoc-ref_count++;
-   newobj-converter = obj-converter;
-   if (obj-converter) obj-converter-ref_count++;
-
-   switch(node) {
+   switch (node_type) {
case is_root_node:
-   newobj-node = tidyGetRoot(newobj-ptdoc-doc);
+   node = tidyGetRoot(obj-ptdoc-doc);
break;
 
case is_html_node:
-   newobj-node = tidyGetHtml(newobj-ptdoc-doc);
+   node = tidyGetHtml(obj-ptdoc-doc);
break;
 
case is_head_node:
-   newobj-node = tidyGetHead(newobj-ptdoc-doc);
+   node = tidyGetHead(obj-ptdoc-doc);
break;
 
case is_body_node:
-   newobj-node = tidyGetBody(newobj-ptdoc-doc);
+   node = tidyGetBody(obj-ptdoc-doc);
break;
}
 
+   if (!node) {
+   RETURN_NULL();
+   }
+
+   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
+   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
+   newobj-type = is_node;
+   newobj-ptdoc = obj-ptdoc;
+   newobj-ptdoc-ref_count++;
+   newobj-converter = obj-converter;
+   if (obj-converter) obj-converter-ref_count++;
+
tidy_add_default_properties(newobj, is_node TSRMLS_CC);
 }
 
@@ -1056,7 +1061,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/029.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/tidy/tests/029.phpt
diff -u /dev/null php-src/ext/tidy/tests/029.phpt:1.2
--- /dev/null   Thu Sep 20 22:30:49 2007
+++ php-src/ext/tidy/tests/029.phpt Thu Sep 20 22:30:49 2007
@@ -0,0 +1,28 @@
+--TEST--
+tidy_get_body() crash
+--SKIPIF--
+?php if (!extension_loaded('tidy')) die('skip'); ?
+--FILE--
+?php
+
+// bug report taken from http://news.php.net/php.notes/130628
+
+$inputs = array(
+   'frameset  /frameset',
+   'htmlframeset /frameset /html',
+);
+
+
+foreach ($inputs as $input) { 
+
+   $t = tidy_parse_string($input);
+   $t-cleanRepair();
+   var_dump(tidy_get_body($t));
+}
+
+echo Done\n;
+?
+--EXPECT--
+NULL
+NULL
+Done

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2007-09-20 Thread Nuno Lopes
nlopess Thu Sep 20 22:44:18 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  oops.. thats what you get for commiting code without compiling nor testing..
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.114r2=1.115diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.114 php-src/ext/tidy/tidy.c:1.115
--- php-src/ext/tidy/tidy.c:1.114   Thu Sep 20 22:30:48 2007
+++ php-src/ext/tidy/tidy.c Thu Sep 20 22:44:17 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp $ */
+/* $Id: tidy.c,v 1.115 2007/09/20 22:44:17 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -932,8 +932,9 @@
 
tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
-   newobj-type = is_node;
+   newobj-type  = is_node;
newobj-ptdoc = obj-ptdoc;
+   newobj-node  = node;
newobj-ptdoc-ref_count++;
newobj-converter = obj-converter;
if (obj-converter) obj-converter-ref_count++;
@@ -1061,7 +1062,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.115 2007/09/20 22:44:17 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 007.phpt

2007-05-04 Thread Nuno Lopes
nlopess Fri May  4 17:45:56 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 007.phpt 
  Log:
  use the new 's' parameter type and simplify the code
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.112r2=1.113diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.112 php-src/ext/tidy/tidy.c:1.113
--- php-src/ext/tidy/tidy.c:1.112   Thu Feb  8 16:37:52 2007
+++ php-src/ext/tidy/tidy.c Fri May  4 17:45:56 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp $ */
+/* $Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1056,7 +1056,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1173,38 +1173,27 @@
Parse a document stored in a string */
 static PHP_FUNCTION(tidy_parse_string)
 {
-   zstr input, enc = NULL_ZSTR;
-   zend_uchar input_type, enc_type = IS_STRING;
+   zstr input;
+   char *enc = NULL;
+   zend_uchar input_type;
int input_len, enc_len;
zval **options = NULL;
PHPTidyObj *obj;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|Zt, input, 
input_len, input_type, options, enc, enc_len, enc_type) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|Zs, input, 
input_len, input_type, options, enc, enc_len, UG(ascii_conv)) == FAILURE) {
RETURN_FALSE;
}
 
-   if (enc_type != IS_STRING) {
-   enc.s = zend_unicode_to_ascii(enc.u, enc_len TSRMLS_CC);
-   if (!enc.s) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or 
ASCII-Unicode string expected, non-ASCII-Unicode string received);
-   RETURN_FALSE;
-   }
-   }
-
tidy_instanciate(tidy_ce_doc, return_value TSRMLS_CC);
obj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
 
TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
 
-   if (php_tidy_parse_string(obj, input.s, input_len, enc.s TSRMLS_CC) == 
FAILURE) {
+   if (php_tidy_parse_string(obj, input.s, input_len, enc TSRMLS_CC) == 
FAILURE) {
zval_dtor(return_value);
INIT_ZVAL(*return_value);
RETVAL_FALSE;
}
-
-   if (enc_type != IS_STRING) {
-   efree(enc.s);
-   }
 }
 /* }}} */
 
@@ -1339,48 +1328,31 @@
 static PHP_FUNCTION(tidy_get_opt_doc)
 {
PHPTidyObj *obj;
-   char *optval;
-   zstr optname;
-   zend_uchar optname_type;
+   char *optval, *optname;
int optname_len;
TidyOption opt;
 
TIDY_SET_CONTEXT;
 
if (object) {
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, 
optname, optname_len, optname_type) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, 
optname, optname_len, UG(ascii_conv)) == FAILURE) {
RETURN_FALSE;
}
} else {
-   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
NULL, Ot, object, tidy_ce_doc, optname, optname_len, optname_type) == 
FAILURE) {
-   RETURN_FALSE;
-   }
-   }
-
-   if (optname_type != IS_STRING) {
-   optname.s = zend_unicode_to_ascii(optname.u, optname_len 
TSRMLS_CC);
-   if (!optname.s) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Binary or 
ASCII-Unicode string expected, non-ASCII-Unicode string received);
+   if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
NULL, Os, object, tidy_ce_doc, optname, optname_len, UG(ascii_conv)) == 
FAILURE) {
RETURN_FALSE;
}
}
 
obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC);
 
-   opt = tidyGetOptionByName(obj-ptdoc-doc, optname.s);
+   opt = tidyGetOptionByName(obj-ptdoc-doc, optname);
 
if (!opt) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown Tidy 
Configuration Option '%s', optname.s);
-   if (optname_type != IS_STRING) {
-   efree(optname.s);
-   }
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown Tidy 
Configuration Option '%s', optname);
RETURN_FALSE;
}
 
-   if 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 004.phpt 007.phpt 010.phpt 011.phpt 012.phpt 019.phpt 024.phpt 025.phpt 027.phpt

2007-02-08 Thread Nuno Lopes
nlopess Thu Feb  8 16:37:52 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 004.phpt 007.phpt 010.phpt 011.phpt 
012.phpt 019.phpt 024.phpt 025.phpt 
027.phpt 
  Log:
  fix a few tests (segfaults + wrong output)
  http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.111r2=1.112diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.111 php-src/ext/tidy/tidy.c:1.112
--- php-src/ext/tidy/tidy.c:1.111   Tue Jan 23 19:50:14 2007
+++ php-src/ext/tidy/tidy.c Thu Feb  8 16:37:52 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp $ */
+/* $Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -420,7 +420,7 @@
case TidyString:
if (Z_TYPE(conv) != IS_STRING) {
zval_copy_ctor(conv);
-   convert_to_string(conv);
+   convert_to_string_with_converter(conv, 
UG(ascii_conv));
}
if (tidyOptSetValue(doc, tidyOptGetId(opt), 
Z_STRVAL(conv))) {
if (Z_TYPE(conv) != Z_TYPE_P(value)) {
@@ -696,6 +696,7 @@
 
case IS_UNICODE:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
+   tidyBufInit(output);
tidySaveBuffer (obj-ptdoc-doc, output);
ZVAL_U_STRINGL(obj-converter-conv, out, (char *) 
output.bp, output.size ? output.size-1 : 0, 1);
tidyBufFree(output);
@@ -731,20 +732,23 @@
tidyBufInit(buf);
if (obj-ptdoc) {
tidyNodeGetText(obj-ptdoc-doc, obj-node, 
buf);
-   ZVAL_STRINGL(out, (char *) buf.bp, buf.size-1, 
0);
+   ZVAL_STRINGL(out, (char *) buf.bp, buf.size-1, 
1);
} else {
ZVAL_EMPTY_STRING(out);
}
+   tidyBufFree(buf);
break;
 
case IS_UNICODE:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
+   tidyBufInit(buf);
if (obj-ptdoc) {
tidyNodeGetText(obj-ptdoc-doc, obj-node, 
buf);
-   ZVAL_U_STRINGL(obj-converter-conv, out, (char 
*) buf.bp, buf.size-1, 0);
+   ZVAL_U_STRINGL(obj-converter-conv, out, (char 
*) buf.bp, buf.size ? buf.size-1 : 0, 1);
} else {
ZVAL_EMPTY_UNICODE(out);
}
+   tidyBufFree(buf);
break;
 
default:
@@ -795,7 +799,7 @@
case is_node:
tidyBufInit(buf);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ADD_PROPERTY_STRINGL(obj-converter-conv, 
obj-std.properties, value, buf.bp, buf.size-1);
+   ADD_PROPERTY_STRINGL(obj-converter-conv, 
obj-std.properties, value, buf.bp, buf.size ? buf.size-1 : 0);
tidyBufFree(buf);
 
ADD_PROPERTY_ASCII_STRING(obj-std.properties, name, 
tidyNodeGetName(obj-node));
@@ -847,6 +851,8 @@
newobj-type = is_node;
newobj-ptdoc = obj-ptdoc;
newobj-ptdoc-ref_count++;
+   newobj-converter = obj-converter;
+   if (obj-converter) 
obj-converter-ref_count++;
 
tidy_add_default_properties(newobj, 
is_node TSRMLS_CC);
add_next_index_zval(children, temp);
@@ -906,6 +912,8 @@
newobj-type = is_node;
newobj-ptdoc = obj-ptdoc;
newobj-ptdoc-ref_count++;
+   newobj-converter = obj-converter;
+   if (obj-converter) obj-converter-ref_count++;
 
switch(node) {
case is_root_node:
@@ -1048,7 +1056,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.112 2007/02/08 16:37:52 nlopess Exp 
$));

[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 027.phpt

2007-01-23 Thread Nuno Lopes
nlopess Tue Jan 23 19:50:14 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 027.phpt 
  Log:
  MFB: fix a few crashes
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.110r2=1.111diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.110 php-src/ext/tidy/tidy.c:1.111
--- php-src/ext/tidy/tidy.c:1.110   Sat Jan 20 12:58:20 2007
+++ php-src/ext/tidy/tidy.c Tue Jan 23 19:50:14 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.110 2007/01/20 12:58:20 nlopess Exp $ */
+/* $Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -42,7 +42,7 @@
 
 /* {{{ ext/tidy macros
 */
-#define FIX_BUFFER(bptr) (bptr)-bp[(bptr)-size-1] = '\0'
+#define FIX_BUFFER(bptr) do { if ((bptr)-size) { (bptr)-bp[(bptr)-size-1] = 
'\0'; } } while(0)
 
 #define TIDY_SET_CONTEXT \
 zval *object = getThis();
@@ -526,7 +526,7 @@
 
tidySaveBuffer (doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL((char *) output.bp, 
output.size-1, 1);
+   RETVAL_STRINGL((char *) output.bp, output.size 
? output.size-1 : 0, 1);
tidyBufFree(output);
} else {
RETVAL_FALSE;
@@ -690,14 +690,14 @@
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidyBufInit(output);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_STRINGL(out, (char *) output.bp, output.size, 1);
+   ZVAL_STRINGL(out, (char *) output.bp, output.size ? 
output.size-1 : 0, 1);
tidyBufFree(output);
break;
 
case IS_UNICODE:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_U_STRINGL(obj-converter-conv, out, (char *) 
output.bp, output.size, 1);
+   ZVAL_U_STRINGL(obj-converter-conv, out, (char *) 
output.bp, output.size ? output.size-1 : 0, 1);
tidyBufFree(output);
break;
 
@@ -765,9 +765,9 @@
if (output.size) {
MAKE_STD_ZVAL(temp);
if (UG(unicode)) {
-   ZVAL_U_STRINGL(obj-converter-conv, temp, (char *) 
output.bp, output.size, 1);
+   ZVAL_U_STRINGL(obj-converter-conv, temp, (char *) 
output.bp, output.size-1, 1);
} else {
-   ZVAL_STRINGL(temp, (char *) output.bp, output.size, 1);
+   ZVAL_STRINGL(temp, (char *) output.bp, output.size-1, 
1);
}
zend_ascii_hash_update(obj-std.properties, value, 
sizeof(value), (void *)temp, sizeof(zval *), NULL);
}
@@ -1048,7 +1048,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.110 2007/01/20 12:58:20 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.111 2007/01/23 19:50:14 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1148,7 +1148,7 @@
tidySaveBuffer(doc, outbuf);
FIX_BUFFER(outbuf);
output_context-out.data = (char *) outbuf.bp;
-   output_context-out.used = outbuf.size - 1;
+   output_context-out.used = outbuf.size ? 
outbuf.size-1 : 0;
output_context-out.free = 1;
status = SUCCESS;
}
@@ -1224,7 +1224,7 @@
tidyBufInit(output);
tidySaveBuffer(obj-ptdoc-doc, output);
FIX_BUFFER(output);
-   RETVAL_U_STRINGL(obj-converter-conv, (char *) output.bp, 
output.size-1, 1);
+   RETVAL_U_STRINGL(obj-converter-conv, (char *) output.bp, output.size 
? output.size-1 : 0, 1);
tidyBufFree(output);
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/027.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/tidy/tests/027.phpt
diff -u /dev/null php-src/ext/tidy/tests/027.phpt:1.2
--- /dev/null   Tue Jan 23 19:50:14 2007
+++ php-src/ext/tidy/tests/027.phpt Tue Jan 23 19:50:14 2007
@@ -0,0 +1,59 @@
+--TEST--
+Bug: tidy segfaults with markup=false
+--SKIPIF--
+?php if (!extension_loaded('tidy')) die('skip'); ?
+--FILE--
+?php
+
+// bug report from 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2007-01-20 Thread Nuno Lopes
nlopess Sat Jan 20 12:27:55 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MFB: fix crash
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.108r2=1.109diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.108 php-src/ext/tidy/tidy.c:1.109
--- php-src/ext/tidy/tidy.c:1.108   Fri Jan 19 18:57:06 2007
+++ php-src/ext/tidy/tidy.c Sat Jan 20 12:27:55 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.108 2007/01/19 18:57:06 nlopess Exp $ */
+/* $Id: tidy.c,v 1.109 2007/01/20 12:27:55 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1040,7 +1040,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.108 2007/01/19 18:57:06 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.109 2007/01/20 12:27:55 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1712,7 +1712,7 @@
 {
TIDY_FETCH_ONLY_OBJECT;
 
-   if (tidyGetNext(obj-node)) {
+   if (obj-node  tidyGetNext(obj-node)) {
RETURN_TRUE;
} else {
RETURN_FALSE;

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 024.phpt 025.phpt 026.phpt

2007-01-20 Thread Nuno Lopes
nlopess Sat Jan 20 12:58:20 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 024.phpt 025.phpt 026.phpt 
  Log:
  MFB: fix crash  add tests
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.109r2=1.110diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.109 php-src/ext/tidy/tidy.c:1.110
--- php-src/ext/tidy/tidy.c:1.109   Sat Jan 20 12:27:55 2007
+++ php-src/ext/tidy/tidy.c Sat Jan 20 12:58:20 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.109 2007/01/20 12:27:55 nlopess Exp $ */
+/* $Id: tidy.c,v 1.110 2007/01/20 12:58:20 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -729,14 +729,22 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidyBufInit(buf);
-   tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ZVAL_STRINGL(out, (char *) buf.bp, buf.size, 0);
+   if (obj-ptdoc) {
+   tidyNodeGetText(obj-ptdoc-doc, obj-node, 
buf);
+   ZVAL_STRINGL(out, (char *) buf.bp, buf.size-1, 
0);
+   } else {
+   ZVAL_EMPTY_STRING(out);
+   }
break;
 
case IS_UNICODE:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
-   tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ZVAL_U_STRINGL(obj-converter-conv, out, (char *) 
buf.bp, buf.size, 0);
+   if (obj-ptdoc) {
+   tidyNodeGetText(obj-ptdoc-doc, obj-node, 
buf);
+   ZVAL_U_STRINGL(obj-converter-conv, out, (char 
*) buf.bp, buf.size-1, 0);
+   } else {
+   ZVAL_EMPTY_UNICODE(out);
+   }
break;
 
default:
@@ -1040,7 +1048,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.109 2007/01/20 12:27:55 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.110 2007/01/20 12:58:20 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/024.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/tidy/tests/024.phpt
diff -u /dev/null php-src/ext/tidy/tests/024.phpt:1.2
--- /dev/null   Sat Jan 20 12:58:20 2007
+++ php-src/ext/tidy/tests/024.phpt Sat Jan 20 12:58:20 2007
@@ -0,0 +1,41 @@
+--TEST--
+libtidy handling of 'new-blocklevel-tags'
+--SKIPIF--
+?php
+if (!extension_loaded('tidy')) die('skip');
+if (strtotime(tidy_get_release())  strtotime('20 january 2007')) die ('skip 
old libtidy');
+?
+--FILE--
+?php
+
+// more info at 
http://sf.net/tracker/?func=detailatid=390963aid=1598422group_id=27659
+
+$contents = '
+wps:block
+wps:var
+wps:value/
+/wps:var
+/wps:block';
+
+$config = array(
+'new-blocklevel-tags' = 'wps:block,wps:var,wps:value'
+);
+
+$tidy = tidy_parse_string($contents, $config, 'utf8');
+$tidy-cleanRepair();
+
+var_dump($tidy-value);
+
+?
+--EXPECT--
+string(117) html
+head
+title/title
+/head
+body
+wps:block
+wps:var
+wps:value/wps:var
+/wps:block
+/body
+/html
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/025.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/tidy/tests/025.phpt
diff -u /dev/null php-src/ext/tidy/tests/025.phpt:1.2
--- /dev/null   Sat Jan 20 12:58:20 2007
+++ php-src/ext/tidy/tests/025.phpt Sat Jan 20 12:58:20 2007
@@ -0,0 +1,50 @@
+--TEST--
+tidyNode tests
+--SKIPIF--
+?php if (!extension_loaded('tidy')) die('skip'); ?
+--FILE--
+?php
+
+new tidyNode;
+$node = new tidyNode();
+
+var_dump($node-isPhp());
+var_dump($node-isText());
+var_dump($node-isComment());
+var_dump($node-hasSiblings());
+var_dump((string)$node);
+
+$tidy=tidy_parse_string('% %');
+var_dump($tidy-Root()-child[0]-isAsp());
+
+$tidy=tidy_parse_string('# #');
+var_dump($tidy-Root()-child[0]-isJste());
+
+$tidy=tidy_parse_string('htmlbodytext/body/html');
+var_dump($tidy-Root()-child[0]-child[1]-child[0]-isText());
+
+$tidy=tidy_parse_string('htmlbody!-- comment --/body/html');
+$n = $tidy-Root()-child[0]-child[1]-child[0];
+var_dump($n-isComment());
+var_dump((string)$n);
+var_dump((bool)$n);
+var_dump((double)$n);
+var_dump((int)$n);
+var_dump($tidy-Root()-child[0]-child[0]-hasSiblings());
+
+?
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+string(0) 
+bool(true)
+bool(true)
+bool(true)
+bool(true)

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2007-01-19 Thread Nuno Lopes
nlopess Fri Jan 19 18:57:06 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MFB: fix segfaults with new libtidy
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.107r2=1.108diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.107 php-src/ext/tidy/tidy.c:1.108
--- php-src/ext/tidy/tidy.c:1.107   Mon Jan  1 09:29:33 2007
+++ php-src/ext/tidy/tidy.c Fri Jan 19 18:57:06 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.107 2007/01/01 09:29:33 sebastian Exp $ */
+/* $Id: tidy.c,v 1.108 2007/01/19 18:57:06 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -511,8 +511,8 @@
}

if (data) {
-   TidyBuffer buf = {0};
-   
+   TidyBuffer buf;
+
tidyBufInit(buf);
tidyBufAttach(buf, (byte *) data, data_len);

@@ -521,7 +521,8 @@
RETVAL_FALSE;
} else {
if (tidyCleanAndRepair(doc) = 0) {
-   TidyBuffer output = {0};
+   TidyBuffer output;
+   tidyBufInit(output);
 
tidySaveBuffer (doc, output);
FIX_BUFFER(output);
@@ -669,7 +670,7 @@
 
 static int tidy_doc_cast_handler(zval *in, zval *out, int type, void *extra 
TSRMLS_DC)
 {
-   TidyBuffer output = {0};
+   TidyBuffer output;
PHPTidyObj *obj;
 
switch(type) {
@@ -687,6 +688,7 @@
 
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
+   tidyBufInit(output);
tidySaveBuffer (obj-ptdoc-doc, output);
ZVAL_STRINGL(out, (char *) output.bp, output.size, 1);
tidyBufFree(output);
@@ -708,7 +710,7 @@
 
 static int tidy_node_cast_handler(zval *in, zval *out, int type, void *extra 
TSRMLS_DC)
 {
-   TidyBuffer buf = {0};
+   TidyBuffer buf;
PHPTidyObj *obj;
 
switch(type) {
@@ -726,6 +728,7 @@
 
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
+   tidyBufInit(buf);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
ZVAL_STRINGL(out, (char *) buf.bp, buf.size, 0);
break;
@@ -745,9 +748,10 @@
 
 static void tidy_doc_update_properties(PHPTidyObj *obj TSRMLS_DC)
 {
-   TidyBuffer output = {0};
+   TidyBuffer output;
zval *temp;
 
+   tidyBufInit(output);
tidySaveBuffer (obj-ptdoc-doc, output);
 
if (output.size) {
@@ -781,8 +785,7 @@
switch(type) {
 
case is_node:
-
-   memset(buf, 0, sizeof(buf));
+   tidyBufInit(buf);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
ADD_PROPERTY_STRINGL(obj-converter-conv, 
obj-std.properties, value, buf.bp, buf.size-1);
tidyBufFree(buf);
@@ -854,9 +857,6 @@
ADD_PROPERTY_NULL(obj-std.properties, errorBuffer);
ADD_PROPERTY_NULL(obj-std.properties, value);
break;
-
-   default:
-   break;
}
 }
 
@@ -965,7 +965,7 @@
 
 static int php_tidy_parse_string(PHPTidyObj *obj, char *string, int len, char 
*enc TSRMLS_DC)
 {
-   TidyBuffer buf = {0};
+   TidyBuffer buf;
UErrorCode Uerror = U_ZERO_ERROR;
 
if(enc) {
@@ -1040,7 +1040,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.107 2007/01/01 09:29:33 sebastian 
Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.108 2007/01/19 18:57:06 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1119,7 +1119,7 @@
 {
int status = FAILURE;
TidyDoc doc;
-   TidyBuffer inbuf = {0}, outbuf = {0}, errbuf = {0};
+   TidyBuffer inbuf, outbuf, errbuf;
PHP_OUTPUT_TSRMLS(output_context);

if (TG(clean_output)  (output_context-op  PHP_OUTPUT_HANDLER_START) 
 (output_context-op  PHP_OUTPUT_HANDLER_FINAL)) {
@@ -1210,9 +1210,10 @@
Return a string representing the parsed tidy markup */
 static PHP_FUNCTION(tidy_get_output)
 {
-   TidyBuffer output = {0};
+   TidyBuffer output;
TIDY_FETCH_OBJECT;
 
+   tidyBufInit(output);
tidySaveBuffer(obj-ptdoc-doc, output);

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-11-01 Thread Nuno Lopes
nlopess Wed Nov  1 18:28:37 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  start converting the tidy and tidyNode objects to be Unicode aware
  I added a converter pointer per node, so that the text can be converted to 
unicode when requested
  this commit also breaks a few tests in unicode mode, but it isnt scary at 
this time :P
  http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.104r2=1.105diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.104 php-src/ext/tidy/tidy.c:1.105
--- php-src/ext/tidy/tidy.c:1.104   Fri Oct 13 14:52:19 2006
+++ php-src/ext/tidy/tidy.c Wed Nov  1 18:28:37 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.104 2006/10/13 14:52:19 andrei Exp $ */
+/* $Id: tidy.c,v 1.105 2006/11/01 18:28:37 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -73,7 +73,7 @@
 if(_val) { \
 if(Z_TYPE_PP(_val) == IS_ARRAY) { \
 _php_tidy_apply_config_array(_doc, HASH_OF(*_val) TSRMLS_CC); \
-} else { \
+} else if (Z_TYPE_PP(_val) != IS_NULL) { \
 convert_to_string_ex(_val); \
 TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_PP(_val)); \
 switch (tidyLoadConfig(_doc, Z_STRVAL_PP(_val))) { \
@@ -109,16 +109,16 @@
 #define FALSE 0
 #endif
 
-#define ADD_PROPERTY_STRING(_table, _key, _string) \
+#define ADD_PROPERTY_ASCII_STRING(_table, _key, _string) \
{ \
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
if (_string) { \
-   ZVAL_STRING(tmp, (char *)_string, 1); \
+   ZVAL_ASCII_STRING(tmp, (char *)_string, 1); \
} else { \
ZVAL_EMPTY_STRING(tmp); \
} \
-   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void 
*)tmp, sizeof(zval *), NULL); \
}
 
 #define ADD_PROPERTY_STRINGL(_table, _key, _string, _len) \
@@ -130,7 +130,7 @@
} else { \
ZVAL_EMPTY_STRING(tmp); \
} \
-   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
}
 
 #define ADD_PROPERTY_LONG(_table, _key, _long) \
@@ -138,7 +138,7 @@
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
ZVAL_LONG(tmp, _long); \
-   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void 
*)tmp, sizeof(zval *), NULL); \
}
 
 #define ADD_PROPERTY_NULL(_table, _key) \
@@ -146,7 +146,7 @@
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
ZVAL_NULL(tmp); \
-   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void 
*)tmp, sizeof(zval *), NULL); \
}
 
 #define ADD_PROPERTY_BOOL(_table, _key, _bool) \
@@ -154,7 +154,7 @@
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
ZVAL_BOOL(tmp, _bool); \
-   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
}
 
 #define TIDY_OPEN_BASEDIR_CHECK(filename) \
@@ -193,11 +193,17 @@
unsigned int ref_count;
 };
 
+typedef struct _PHPTidyConv {
+   UConverter *conv;
+   unsigned long ref_count;
+} PHPTidyConv;
+
 struct _PHPTidyObj {
zend_object std;
TidyNodenode;
tidy_obj_type   type;
PHPTidyDoc  *ptdoc;
+   PHPTidyConv *converter;
 };
 /* }}} */
 
@@ -240,7 +246,6 @@
 static PHP_FUNCTION(tidy_get_output);
 static PHP_FUNCTION(tidy_get_error_buffer);
 static PHP_FUNCTION(tidy_get_release);
-static PHP_FUNCTION(tidy_reset_config);
 static PHP_FUNCTION(tidy_get_config);
 static PHP_FUNCTION(tidy_get_status);
 static PHP_FUNCTION(tidy_get_html_ver);
@@ -571,6 +576,11 @@
}
}
 
+   if (intern-converter  --intern-converter-ref_count = 0) {
+   ucnv_close(intern-converter-conv);
+   efree(intern-converter);
+   }
+
efree(object);
 }
 
@@ -595,6 +605,7 @@
intern-ptdoc-doc = tidyCreate();
intern-ptdoc-ref_count = 1;
intern-ptdoc-errbuf = emalloc(sizeof(TidyBuffer));
+   intern-converter = NULL;
tidyBufInit(intern-ptdoc-errbuf);
 
if (tidySetErrorBuffer(intern-ptdoc-doc, 
intern-ptdoc-errbuf) != 0) {
@@ -613,9 +624,6 @@
 
   

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-11-01 Thread Nuno Lopes
nlopess Wed Nov  1 18:55:03 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  convert a few more functions
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.105r2=1.106diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.105 php-src/ext/tidy/tidy.c:1.106
--- php-src/ext/tidy/tidy.c:1.105   Wed Nov  1 18:28:37 2006
+++ php-src/ext/tidy/tidy.c Wed Nov  1 18:55:02 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.105 2006/11/01 18:28:37 nlopess Exp $ */
+/* $Id: tidy.c,v 1.106 2006/11/01 18:55:02 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -121,12 +121,12 @@
zend_ascii_hash_update(_table, #_key, sizeof(#_key), (void 
*)tmp, sizeof(zval *), NULL); \
}
 
-#define ADD_PROPERTY_STRINGL(_table, _key, _string, _len) \
+#define ADD_PROPERTY_STRINGL(_conv, _table, _key, _string, _len) \
{ \
zval *tmp; \
MAKE_STD_ZVAL(tmp); \
if (_string) { \
-   ZVAL_STRINGL(tmp, (char *)_string, _len, 1); \
+   ZVAL_U_STRINGL(_conv, tmp, (char *)_string, _len, 1); \
} else { \
ZVAL_EMPTY_STRING(tmp); \
} \
@@ -784,7 +784,7 @@
 
memset(buf, 0, sizeof(buf));
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ADD_PROPERTY_STRINGL(obj-std.properties, value, 
buf.bp, buf.size-1);
+   ADD_PROPERTY_STRINGL(obj-converter-conv, 
obj-std.properties, value, buf.bp, buf.size-1);
tidyBufFree(buf);
 
ADD_PROPERTY_ASCII_STRING(obj-std.properties, name, 
tidyNodeGetName(obj-node));
@@ -1002,9 +1002,7 @@
REGISTER_INI_ENTRIES();
REGISTER_TIDY_CLASS(tidy, doc,  NULL, 0);
REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS);
-   /* no exceptions for now..
-   REGISTER_TIDY_CLASS(tidyException, exception,   
zend_exception_get_default(TSRMLS_C));
-   */
+
tidy_object_handlers_doc.get_class_entry = tidy_get_ce_doc;
tidy_object_handlers_node.get_class_entry = tidy_get_ce_node;

@@ -1042,7 +1040,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.105 2006/11/01 18:28:37 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.106 2006/11/01 18:55:02 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1155,7 +1153,7 @@
return status;
 }
 
-/* {{{ proto bool tidy_parse_string(string input [, mixed config_options [, 
string encoding]])
+/* {{{ proto bool tidy_parse_string(string input [, mixed config_options [, 
string encoding]]) U
Parse a document stored in a string */
 static PHP_FUNCTION(tidy_parse_string)
 {
@@ -1194,21 +1192,21 @@
 }
 /* }}} */
 
-/* {{{ proto string tidy_get_error_buffer([boolean detailed])
+/* {{{ proto string tidy_get_error_buffer() U
Return warnings and errors which occured parsing the specified document*/
 static PHP_FUNCTION(tidy_get_error_buffer)
 {
TIDY_FETCH_OBJECT;
 
if (obj-ptdoc-errbuf  obj-ptdoc-errbuf-bp) {
-   RETURN_STRINGL((char *) obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, 1);
+   RETURN_ASCII_STRINGL((char *) obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, 1);
} else {
RETURN_FALSE;
}
 }
 /* }}} */
 
-/* {{{ proto string tidy_get_output()
+/* {{{ proto string tidy_get_output() U
Return a string representing the parsed tidy markup */
 static PHP_FUNCTION(tidy_get_output)
 {
@@ -1217,7 +1215,7 @@
 
tidySaveBuffer(obj-ptdoc-doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL((char *) output.bp, output.size-1, 1);
+   RETVAL_U_STRINGL(obj-converter-conv, (char *) output.bp, 
output.size-1, 1);
tidyBufFree(output);
 }
 /* }}} */
@@ -1259,7 +1257,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_clean_repair()
+/* {{{ proto boolean tidy_clean_repair() U
Execute configured cleanup and repair operations on parsed markup */
 static PHP_FUNCTION(tidy_clean_repair)
 {
@@ -1290,7 +1288,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_diagnose()
+/* {{{ proto boolean tidy_diagnose() U
Run configured diagnostics on parsed and repaired markup. */
 static PHP_FUNCTION(tidy_diagnose)
 {
@@ -1324,31 +1322,48 @@
 static PHP_FUNCTION(tidy_get_opt_doc)
 {
PHPTidyObj *obj;
-   char *optname, *optval;
+   char *optval;
+   zstr optname;
+   zend_uchar optname_type;
int optname_len;
TidyOption opt;
 
TIDY_SET_CONTEXT;
 
if (object) {
-   

Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-11-01 Thread Andrei Zmievski
Do you need a separate converter per node? Can they all be different 
for some reason?


-Andrei

On Nov 1, 2006, at 10:28 AM, Nuno Lopes wrote:


nlopess Wed Nov  1 18:28:37 2006 UTC

  Modified files:
/php-src/ext/tidy   tidy.c
  Log:
  start converting the tidy and tidyNode objects to be Unicode aware
  I added a converter pointer per node, so that the text can be 
converted to unicode when requested
  this commit also breaks a few tests in unicode mode, but it isnt 
scary at this time :P

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


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



Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-11-01 Thread Nuno Lopes
In fact they are all the same. When you pass an html string, it opens a new 
converter (with ref_count=1), and then it just points the child nodes to 
that converter (and incs the ref_counter). So I'm only storing a pointer to 
the converter with a ref. counter associated.
This is needed because you can access child nodes directly. But I still need 
to think more on the subject.


Nuno

- Original Message - 
Do you need a separate converter per node? Can they all be different for 
some reason?


-Andrei

On Nov 1, 2006, at 10:28 AM, Nuno Lopes wrote:


nlopess Wed Nov  1 18:28:37 2006 UTC

  Modified files:
/php-src/ext/tidy tidy.c
  Log:
  start converting the tidy and tidyNode objects to be Unicode aware
  I added a converter pointer per node, so that the text can be converted 
to unicode when requested
  this commit also breaks a few tests in unicode mode, but it isnt scary 
at this time :P 


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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-09-15 Thread Nuno Lopes
nlopess Fri Sep 15 14:59:04 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MFB
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.100r2=1.101diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.100 php-src/ext/tidy/tidy.c:1.101
--- php-src/ext/tidy/tidy.c:1.100   Fri Sep 15 14:43:08 2006
+++ php-src/ext/tidy/tidy.c Fri Sep 15 14:59:04 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.100 2006/09/15 14:43:08 nlopess Exp $ */
+/* $Id: tidy.c,v 1.101 2006/09/15 14:59:04 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -465,8 +465,6 @@
TidyBuffer *errbuf;
zval **config;
 
-   TIDY_SET_CONTEXT;
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|Zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}
@@ -1014,7 +1012,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.100 2006/09/15 14:43:08 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.101 2006/09/15 14:59:04 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-09-07 Thread Michael Wallner
mikeThu Sep  7 14:54:28 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  - add note why we can't have a chunk-sized output handler
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.98r2=1.99diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.98 php-src/ext/tidy/tidy.c:1.99
--- php-src/ext/tidy/tidy.c:1.98Wed Sep  6 17:55:09 2006
+++ php-src/ext/tidy/tidy.c Thu Sep  7 14:54:28 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.98 2006/09/06 17:55:09 mike Exp $ */
+/* $Id: tidy.c,v 1.99 2006/09/07 14:54:28 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1028,7 +1028,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.98 2006/09/06 17:55:09 mike Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.99 2006/09/07 14:54:28 mike Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1078,6 +1078,10 @@
return status;
 }
 
+/*
+ * NOTE: tidy does not support iterative/cumulative parsing, so chunk-sized 
output handler is not possible
+ */
+
 static void php_tidy_clean_output_start(zval *name TSRMLS_DC)
 {
php_output_handler *h;

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-08-31 Thread Antony Dovgal
tony2001Thu Aug 31 13:58:07 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  z/Z problem fixes
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.95r2=1.96diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.95 php-src/ext/tidy/tidy.c:1.96
--- php-src/ext/tidy/tidy.c:1.95Wed Aug 30 22:52:18 2006
+++ php-src/ext/tidy/tidy.c Thu Aug 31 13:58:07 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.95 2006/08/30 22:52:18 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.96 2006/08/31 13:58:07 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -86,17 +86,17 @@
 
 #define TIDY_APPLY_CONFIG_ZVAL(_doc, _val) \
 if(_val) { \
-if(Z_TYPE_P(_val) == IS_ARRAY) { \
-_php_tidy_apply_config_array(_doc, HASH_OF(_val) TSRMLS_CC); \
+if(Z_TYPE_PP(_val) == IS_ARRAY) { \
+_php_tidy_apply_config_array(_doc, HASH_OF(*_val) TSRMLS_CC); \
 } else { \
-convert_to_string(_val); \
-TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_P(_val)); \
-switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
+convert_to_string_ex(_val); \
+TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_PP(_val)); \
+switch (tidyLoadConfig(_doc, Z_STRVAL_PP(_val))) { \
   case -1: \
-php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', Z_STRVAL_P(_val)); \
+php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', Z_STRVAL_PP(_val)); \
 break; \
   case 1: \
-php_error_docref(NULL TSRMLS_CC, E_NOTICE, There were errors 
while parsing the configuration file '%s', Z_STRVAL_P(_val)); \
+php_error_docref(NULL TSRMLS_CC, E_NOTICE, There were errors 
while parsing the configuration file '%s', Z_STRVAL_PP(_val)); \
 break; \
 } \
 } \
@@ -431,11 +431,11 @@
zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
-   zval *config;
+   zval **config;
 
TIDY_SET_CONTEXT;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|Zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}

@@ -991,7 +991,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.95 2006/08/30 22:52:18 tony2001 Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.96 2006/08/31 13:58:07 tony2001 Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1056,13 +1056,13 @@
 {
char *input, *enc = NULL;
int input_len, enc_len = 0;
-   zval *options = NULL;
+   zval **options = NULL;

PHPTidyObj *obj;
 
TIDY_SET_CONTEXT;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zs, input, 
input_len, options, enc, enc_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|Zs, input, 
input_len, options, enc, enc_len) == FAILURE) {
RETURN_FALSE;
}
 
@@ -1116,12 +1116,12 @@
int input_len, contents_len, enc_len = 0;
zend_bool use_include_path = 0;
char *contents;
-   zval *options = NULL;
+   zval **options = NULL;

PHPTidyObj *obj;
TIDY_SET_CONTEXT;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zsb, 
inputfile, input_len,
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|Zsb, 
inputfile, input_len,
  options, enc, 
enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}
@@ -1434,12 +1434,12 @@
int input_len = 0, enc_len = 0, contents_len = 0;
zend_bool use_include_path = 0;
char *contents;
-   zval *options = NULL;
+   zval **options = NULL;

PHPTidyObj *obj;
TIDY_SET_CONTEXT;   

-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |szsb, 
inputfile, input_len,
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |sZsb, 
inputfile, input_len,
  options, enc, 
enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}
@@ -1466,14 +1466,14 @@
int input_len, enc_len = 0, contents_len = 0;
zend_bool use_include_path = 0;
char *contents;
-  

[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 022.phpt

2006-08-30 Thread Antony Dovgal
tony2001Wed Aug 30 22:32:35 2006 UTC

  Added files: 
/php-src/ext/tidy/tests 022.phpt 

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix a couple of leaks, add new test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.93r2=1.94diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.93 php-src/ext/tidy/tidy.c:1.94
--- php-src/ext/tidy/tidy.c:1.93Mon Aug 14 15:17:03 2006
+++ php-src/ext/tidy/tidy.c Wed Aug 30 22:32:35 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.93 2006/08/14 15:17:03 nlopess Exp $ */
+/* $Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -89,7 +89,7 @@
 if(Z_TYPE_P(_val) == IS_ARRAY) { \
 _php_tidy_apply_config_array(_doc, HASH_OF(_val) TSRMLS_CC); \
 } else { \
-convert_to_string_ex(_val); \
+convert_to_string(_val); \
 TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_P(_val)); \
 switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
   case -1: \
@@ -987,7 +987,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.93 2006/08/14 15:17:03 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1398,7 +1398,7 @@
optval = php_tidy_get_opt_val(obj-ptdoc, opt, optt TSRMLS_CC);
switch (optt) {
case TidyString:
-   RETURN_ASCII_STRING((char *)optval, 0);
+   RETURN_ASCII_STRING((char *)optval, ZSTR_AUTOFREE);
break;
 
case TidyInteger:

http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/022.phpt?view=markuprev=1.1
Index: php-src/ext/tidy/tests/022.phpt
+++ php-src/ext/tidy/tests/022.phpt
--TEST--
tidy_repair_*() and invalid parameters
--SKIPIF--
?php if (!extension_loaded(tidy)) print skip; ?
--FILE--
?php

$l = 1;
$s = ;
$a = array();

tidy_repair_string($s, $l, $l, $l);
tidy_repair_string($s, $s, $s, $s);
tidy_repair_string($l, $l, $l ,$l);
tidy_repair_string($a, $a, $a, $a);

tidy_repair_file($s, $l, $l, $l);
tidy_repair_file($s, $s, $s, $s);
tidy_repair_file($l, $l, $l ,$l);
tidy_repair_file($a, $a, $a, $a);

echo Done\n;
?
--EXPECTF-- 
Warning: tidy_repair_string(): Could not load configuration file '1' in %s on 
line %d

Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d

Warning: tidy_repair_string(): Could not load configuration file '' in %s on 
line %d

Warning: tidy_repair_string(): Could not load configuration file '1' in %s on 
line %d

Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d

Warning: tidy_repair_string() expects parameter 1 to be string, array given in 
%s on line %d

Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s 
on line %d
Done

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-08-30 Thread Antony Dovgal
tony2001Wed Aug 30 22:52:18 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix tidy problems caused by returning local static buffers
  looks like somebody forgot to MFB this patch..
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.94r2=1.95diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.94 php-src/ext/tidy/tidy.c:1.95
--- php-src/ext/tidy/tidy.c:1.94Wed Aug 30 22:32:35 2006
+++ php-src/ext/tidy/tidy.c Wed Aug 30 22:52:18 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.95 2006/08/30 22:52:18 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -490,7 +490,8 @@
 
tidySaveBuffer (doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL((char *) output.bp, 
output.size-1, 0);
+   RETVAL_STRINGL((char *) output.bp, 
output.size-1, 1);
+   tidyBufFree(output);
} else {
RETVAL_FALSE;
}
@@ -661,7 +662,8 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_STRINGL(out, (char *) output.bp, output.size, 0);
+   ZVAL_STRINGL(out, (char *) output.bp, output.size, 1);
+   tidyBufFree(output);
break;
 
default:
@@ -712,10 +714,12 @@

if (output.size) {
MAKE_STD_ZVAL(temp);
-   ZVAL_STRINGL(temp, (char *) output.bp, output.size, 0);
+   ZVAL_STRINGL(temp, (char *) output.bp, output.size, 1);
zend_hash_update(obj-std.properties, value, sizeof(value), 
(void *)temp, sizeof(zval *), NULL);
}
 
+   tidyBufFree(output);
+
if (obj-ptdoc-errbuf-size) {
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, (char *) obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, TRUE);
@@ -987,7 +991,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.95 2006/08/30 22:52:18 tony2001 Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1035,7 +1039,8 @@
 
tidySaveBuffer(doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL((char *) output.bp, output.size-1, 0);
+   RETVAL_STRINGL((char *) output.bp, output.size-1, 1);
+   tidyBufFree(output);
}
} else {
RETVAL_NULL();
@@ -1098,7 +1103,8 @@
 
tidySaveBuffer(obj-ptdoc-doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL((char *) output.bp, output.size-1, 0);
+   RETVAL_STRINGL((char *) output.bp, output.size-1, 1);
+   tidyBufFree(output);
 }
 /* }}} */
 

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-07-25 Thread Michael Wallner
mikeTue Jul 25 22:57:31 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  - reduce memory footprint
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.90r2=1.91diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.90 php-src/ext/tidy/tidy.c:1.91
--- php-src/ext/tidy/tidy.c:1.90Sat Jul  8 00:04:37 2006
+++ php-src/ext/tidy/tidy.c Tue Jul 25 22:57:31 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.90 2006/07/08 00:04:37 nlopess Exp $ */
+/* $Id: tidy.c,v 1.91 2006/07/25 22:57:31 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -46,6 +46,7 @@
 /* {{{ ext/tidy macros
 */
 #define REMOVE_NEWLINE(_z) _z-value.str.val[_z-value.str.len-1] = '\0'; 
_z-value.str.len--;
+#define FIX_BUFFER(bptr) (bptr)-bp[(bptr)-size-1] = '\0'
 
 #define TIDYDOC_FROM_OBJECT(tdoc, object) \
{ \
@@ -478,7 +479,7 @@
TidyBuffer buf = {0};

tidyBufInit(buf);
-   tidyBufAppend(buf, data, data_len);
+   tidyBufAttach(buf, data, data_len);

if (tidyParseBuffer(doc, buf)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
errbuf-bp);
@@ -488,14 +489,12 @@
TidyBuffer output = {0};
 
tidySaveBuffer (doc, output);
-   RETVAL_STRINGL(output.bp, output.size-1, 1);
-   tidyBufFree(output);
+   FIX_BUFFER(output);
+   RETVAL_STRINGL(output.bp, output.size-1, 0);
} else {
RETVAL_FALSE;
}
}
-   
-   tidyBufFree(buf);
}
 
if (is_file) {
@@ -662,8 +661,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_STRINGL(out, output.bp, output.size-1, TRUE);
-   tidyBufFree(output);
+   ZVAL_STRINGL(out, output.bp, output.size, 0);
break;
 
default:
@@ -694,8 +692,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ZVAL_STRINGL(out, buf.bp, buf.size-1, TRUE);
-   tidyBufFree(buf);
+   ZVAL_STRINGL(out, buf.bp, buf.size, 0);
break;
 
default:
@@ -715,11 +712,9 @@

if (output.size) {
MAKE_STD_ZVAL(temp);
-   ZVAL_STRINGL(temp, output.bp, output.size-1, TRUE);
+   ZVAL_STRINGL(temp, output.bp, output.size, 0);
zend_hash_update(obj-std.properties, value, sizeof(value), 
(void *)temp, sizeof(zval *), NULL);
}
-   
-   tidyBufFree(output);
 
if (obj-ptdoc-errbuf-size) {
MAKE_STD_ZVAL(temp);
@@ -935,14 +930,12 @@
}

tidyBufInit(buf);
-   tidyBufAppend(buf, string, len);
+   tidyBufAttach(buf, string, len);
if (tidyParseBuffer(obj-ptdoc-doc, buf)  0) {
-   tidyBufFree(buf);
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
obj-ptdoc-errbuf-bp);
return FAILURE;

}
-   tidyBufFree(buf);
tidy_doc_update_properties(obj TSRMLS_CC);
 
return SUCCESS;
@@ -994,7 +987,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.90 2006/07/08 00:04:37 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.91 2006/07/25 22:57:31 mike Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1031,7 +1024,7 @@
TidyBuffer buf = {0};

tidyBufInit(buf);
-   tidyBufAppend(buf, input, input_len);
+   tidyBufAttach(buf, input, input_len);

if (tidyParseBuffer(doc, buf)  0 || tidyCleanAndRepair(doc)  
0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
errbuf.bp);
@@ -1041,12 +1034,9 @@
tidyBufInit(output);
 
tidySaveBuffer(doc, output);
-   RETVAL_STRINGL(output.bp, output.size-1, 1);
-
-   tidyBufFree(output);
+   

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-07-25 Thread Michael Wallner
mikeTue Jul 25 23:03:57 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  - fix compiler warnings
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.91r2=1.92diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.91 php-src/ext/tidy/tidy.c:1.92
--- php-src/ext/tidy/tidy.c:1.91Tue Jul 25 22:57:31 2006
+++ php-src/ext/tidy/tidy.c Tue Jul 25 23:03:56 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.91 2006/07/25 22:57:31 mike Exp $ */
+/* $Id: tidy.c,v 1.92 2006/07/25 23:03:56 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -479,7 +479,7 @@
TidyBuffer buf = {0};

tidyBufInit(buf);
-   tidyBufAttach(buf, data, data_len);
+   tidyBufAttach(buf, (byte *) data, data_len);

if (tidyParseBuffer(doc, buf)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
errbuf-bp);
@@ -490,7 +490,7 @@
 
tidySaveBuffer (doc, output);
FIX_BUFFER(output);
-   RETVAL_STRINGL(output.bp, output.size-1, 0);
+   RETVAL_STRINGL((char *) output.bp, 
output.size-1, 0);
} else {
RETVAL_FALSE;
}
@@ -514,7 +514,7 @@
if (!(stream = php_stream_open_wrapper(filename, rb, 
(use_include_path ? USE_PATH : 0), NULL))) {
return NULL;
}
-   if ((*len = (int) php_stream_copy_to_mem(stream, (void**)data, 
PHP_STREAM_COPY_ALL, 0)) == 0) {
+   if ((*len = (int) php_stream_copy_to_mem(stream, (void*) data, 
PHP_STREAM_COPY_ALL, 0)) == 0) {
data = estrdup();
*len = 0;
}
@@ -661,7 +661,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_STRINGL(out, output.bp, output.size, 0);
+   ZVAL_STRINGL(out, (char *) output.bp, output.size, 0);
break;
 
default:
@@ -692,7 +692,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-   ZVAL_STRINGL(out, buf.bp, buf.size, 0);
+   ZVAL_STRINGL(out, (char *) buf.bp, buf.size, 0);
break;
 
default:
@@ -712,13 +712,13 @@

if (output.size) {
MAKE_STD_ZVAL(temp);
-   ZVAL_STRINGL(temp, output.bp, output.size, 0);
+   ZVAL_STRINGL(temp, (char *) output.bp, output.size, 0);
zend_hash_update(obj-std.properties, value, sizeof(value), 
(void *)temp, sizeof(zval *), NULL);
}
 
if (obj-ptdoc-errbuf-size) {
MAKE_STD_ZVAL(temp);
-   ZVAL_STRINGL(temp, obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, TRUE);
+   ZVAL_STRINGL(temp, (char *) obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, TRUE);
zend_hash_update(obj-std.properties, errorBuffer, 
sizeof(errorBuffer), (void *)temp, sizeof(zval *), NULL);
}
 }
@@ -884,7 +884,7 @@
zend_bool clear_str;
 
for (zend_hash_internal_pointer_reset(ht_options);
-zend_hash_get_current_data(ht_options, (void **)opt_val) == 
SUCCESS;
+zend_hash_get_current_data(ht_options, (void *) opt_val) == 
SUCCESS;
 zend_hash_move_forward(ht_options)) {

switch (zend_hash_get_current_key_ex(ht_options, opt_name, 
opt_name_len, opt_indx, FALSE, NULL)) {
@@ -930,7 +930,7 @@
}

tidyBufInit(buf);
-   tidyBufAttach(buf, string, len);
+   tidyBufAttach(buf, (byte *) string, len);
if (tidyParseBuffer(obj-ptdoc-doc, buf)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
obj-ptdoc-errbuf-bp);
return FAILURE;
@@ -987,7 +987,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.91 2006/07/25 22:57:31 mike Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.92 2006/07/25 23:03:56 mike Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1024,7 +1024,7 @@
TidyBuffer buf = {0};

tidyBufInit(buf);
-   tidyBufAttach(buf, 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-07-07 Thread Nuno Lopes
nlopess Sat Jul  8 00:04:38 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  remove some left overs plus static keywording
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.89r2=1.90diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.89 php-src/ext/tidy/tidy.c:1.90
--- php-src/ext/tidy/tidy.c:1.89Tue Jun 13 13:12:20 2006
+++ php-src/ext/tidy/tidy.c Sat Jul  8 00:04:37 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.89 2006/06/13 13:12:20 dmitry Exp $ */
+/* $Id: tidy.c,v 1.90 2006/07/08 00:04:37 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -315,10 +315,6 @@
{NULL, NULL, NULL}
 };
 
-zend_function_entry tidy_funcs_exception[] = {
-   {NULL, NULL, NULL}
-};
-
 zend_class_entry *tidy_ce_doc, *tidy_ce_node, *tidy_ce_exception;
 
 static zend_object_handlers tidy_object_handlers_doc;
@@ -346,22 +342,22 @@
 ZEND_GET_MODULE(tidy)
 #endif
 
-void* TIDY_CALL php_tidy_malloc(size_t len)
+static void* TIDY_CALL php_tidy_malloc(size_t len)
 {
return emalloc(len);
 }
 
-void* TIDY_CALL php_tidy_realloc(void *buf, size_t len)
+static void* TIDY_CALL php_tidy_realloc(void *buf, size_t len)
 {
return erealloc(buf, len);
 }
 
-void TIDY_CALL php_tidy_free(void *buf)
+static void TIDY_CALL php_tidy_free(void *buf)
 {
efree(buf);
 }
 
-void TIDY_CALL php_tidy_panic(ctmbstr msg)
+static void TIDY_CALL php_tidy_panic(ctmbstr msg)
 {
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory 
for tidy! (Reason: %s), (char *)msg);
@@ -466,8 +462,6 @@
tidyOptSetBool(doc, TidyMark, no);

TIDY_SET_DEFAULT_CONFIG(doc);
-   
-   /* We can't use TIDY_APPLY_CONFIG_ZVAL() here, it uses RETURN_FALSE */
 
if (ZEND_NUM_ARGS()  1) {
TIDY_APPLY_CONFIG_ZVAL(doc, config);
@@ -1000,7 +994,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.89 2006/06/13 13:12:20 dmitry Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.90 2006/07/08 00:04:37 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 007.phpt 021.phpt

2006-05-07 Thread Nuno Lopes
nlopess Sun May  7 18:11:40 2006 UTC

  Added files: 
/php-src/ext/tidy/tests 021.phpt 

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 007.phpt 
  Log:
  convert a few more functions to unicode and adapt the tests as well
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.84r2=1.85diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.84 php-src/ext/tidy/tidy.c:1.85
--- php-src/ext/tidy/tidy.c:1.84Sat May  6 13:19:10 2006
+++ php-src/ext/tidy/tidy.c Sun May  7 18:11:40 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.84 2006/05/06 13:19:10 nlopess Exp $ */
+/* $Id: tidy.c,v 1.85 2006/05/07 18:11:40 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -998,7 +998,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.84 2006/05/06 13:19:10 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.85 2006/05/07 18:11:40 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1220,7 +1220,7 @@
 
 
 #if HAVE_TIDYOPTGETDOC
-/* {{{ proto string tidy_get_opt_doc(tidy resource, string optname)
+/* {{{ proto string tidy_get_opt_doc(tidy resource, string optname) U
Returns the documentation for the given option name */
 PHP_FUNCTION(tidy_get_opt_doc)
 {
@@ -1251,7 +1251,7 @@
}
 
if ( (optval = (char *) tidyOptGetDoc(obj-ptdoc-doc, opt)) ) {
-   RETURN_STRING(optval, 1);
+   RETURN_ASCII_STRING(optval, 1);
}
 
RETURN_FALSE;
@@ -1260,8 +1260,8 @@
 #endif
 
 
-/* {{{ proto array tidy_get_config()
-   Get current Tidy configuarion */
+/* {{{ proto array tidy_get_config() U
+   Get current Tidy configuration */
 PHP_FUNCTION(tidy_get_config)
 {
TidyIterator itOpt;
@@ -1282,7 +1282,7 @@
opt_value = php_tidy_get_opt_val(obj-ptdoc, opt, optt 
TSRMLS_CC);
switch (optt) {
case TidyString:
-   add_assoc_string(return_value, opt_name, 
(char*)opt_value, 0);
+   add_assoc_ascii_string(return_value, opt_name, 
(char*)opt_value, 0);
break;
 
case TidyInteger:
@@ -1414,7 +1414,7 @@
optval = php_tidy_get_opt_val(obj-ptdoc, opt, optt TSRMLS_CC);
switch (optt) {
case TidyString:
-   RETURN_STRING((char *)optval, 0);
+   RETURN_ASCII_STRING((char *)optval, 0);
break;
 
case TidyInteger:
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tests/007.phpt?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/tidy/tests/007.phpt
diff -u php-src/ext/tidy/tests/007.phpt:1.9 php-src/ext/tidy/tests/007.phpt:1.10
--- php-src/ext/tidy/tests/007.phpt:1.9 Mon Nov 22 15:12:32 2004
+++ php-src/ext/tidy/tests/007.phpt Sun May  7 18:11:40 2006
@@ -19,3 +19,7 @@
 Current Value of 'tidy-mark': bool(false)
 Current Value of 'error-file': string(0) 
 Current Value of 'tab-size': int(8)
+--UEXPECT--
+Current Value of 'tidy-mark': bool(false)
+Current Value of 'error-file': unicode(0) 
+Current Value of 'tab-size': int(8)

http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tests/021.phpt?view=markuprev=1.1
Index: php-src/ext/tidy/tests/021.phpt
+++ php-src/ext/tidy/tests/021.phpt
--TEST--
tidy_get_opt_doc()
--SKIPIF--
?php if (!extension_loaded(tidy) || !function_exists('tidy_get_opt_doc')) 
print skip; ?
--FILE--
?php

var_dump(tidy_get_opt_doc(new tidy, 'some_bogus_cfg'));

$t = new tidy;
var_dump($t-getOptDoc('ncr'));
var_dump(strlen(tidy_get_opt_doc($t, 'wrap'))  99);
?
--EXPECT--
Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg' 
in /cvs/php-src/ext/tidy/tests/021.php on line 3
bool(false)
string(73) This option specifies if Tidy should allow numeric character 
references. 
bool(true)
--UEXPECT--
Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg' 
in /cvs/php-src/ext/tidy/tests/021.php on line 3
bool(false)
unicode(73) This option specifies if Tidy should allow numeric character 
references. 
bool(true)

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-05-06 Thread Nuno Lopes
nlopess Sat May  6 10:48:04 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  use the new zend_unicode_to_ascii() function. this should also fix windows 
builds
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.82r2=1.83diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.82 php-src/ext/tidy/tidy.c:1.83
--- php-src/ext/tidy/tidy.c:1.82Tue Apr 25 14:54:33 2006
+++ php-src/ext/tidy/tidy.c Sat May  6 10:48:04 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.82 2006/04/25 14:54:33 nlopess Exp $ */
+/* $Id: tidy.c,v 1.83 2006/05/06 10:48:04 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -888,12 +888,8 @@
zval **opt_val;
ulong opt_indx;
uint opt_name_len;
-   UConverter *conv = NULL;
-   UErrorCode status = U_ZERO_ERROR;
zend_bool clear_str;
 
-   zend_set_converter_encoding(conv, ASCII);
-
for (zend_hash_internal_pointer_reset(ht_options);
 zend_hash_get_current_data(ht_options, (void **)opt_val) == 
SUCCESS;
 zend_hash_move_forward(ht_options)) {
@@ -904,10 +900,9 @@
break;
 
case HASH_KEY_IS_UNICODE:
-   zend_convert_from_unicode(conv, (opt_name.s), 
opt_name_len, opt_name.u, opt_name_len, status);
-   if (U_FAILURE(status)) {
+   opt_name.s = zend_unicode_to_ascii(opt_name.u, 
opt_name_len);
+   if (!opt_name.s) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Could not convert key from the option array);
-   ucnv_close(conv);
return FAILURE;
}
clear_str = 1;
@@ -918,7 +913,6 @@
 
default:
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 
retrieve key from option array);
-   ucnv_close(conv);
return FAILURE;
}
 
@@ -928,7 +922,6 @@
}
}
 
-   ucnv_close(conv);
return SUCCESS;
 }
 
@@ -1005,7 +998,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.82 2006/04/25 14:54:33 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.83 2006/05/06 10:48:04 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-05-06 Thread Nuno Lopes
nlopess Sat May  6 13:19:10 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix thread safe build
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.83r2=1.84diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.83 php-src/ext/tidy/tidy.c:1.84
--- php-src/ext/tidy/tidy.c:1.83Sat May  6 10:48:04 2006
+++ php-src/ext/tidy/tidy.c Sat May  6 13:19:10 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.83 2006/05/06 10:48:04 nlopess Exp $ */
+/* $Id: tidy.c,v 1.84 2006/05/06 13:19:10 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -900,7 +900,7 @@
break;
 
case HASH_KEY_IS_UNICODE:
-   opt_name.s = zend_unicode_to_ascii(opt_name.u, 
opt_name_len);
+   opt_name.s = zend_unicode_to_ascii(opt_name.u, 
opt_name_len TSRMLS_CC);
if (!opt_name.s) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Could not convert key from the option array);
return FAILURE;
@@ -998,7 +998,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.83 2006/05/06 10:48:04 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.84 2006/05/06 13:19:10 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-25 Thread Nuno Lopes
nlopess Tue Apr 25 12:41:59 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  mark a couple of functions as unicode-safe. no changes to code required
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.80r2=1.81diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.80 php-src/ext/tidy/tidy.c:1.81
--- php-src/ext/tidy/tidy.c:1.80Sun Apr 23 12:56:10 2006
+++ php-src/ext/tidy/tidy.c Tue Apr 25 12:41:59 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.80 2006/04/23 12:56:10 nlopess Exp $ */
+/* $Id: tidy.c,v 1.81 2006/04/25 12:41:59 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -985,7 +985,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.80 2006/04/23 12:56:10 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.81 2006/04/25 12:41:59 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1286,7 +1286,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_get_status()
+/* {{{ proto int tidy_get_status() U
Get status of specfied document. */
 PHP_FUNCTION(tidy_get_status)
 {
@@ -1296,7 +1296,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_get_html_ver()
+/* {{{ proto int tidy_get_html_ver() U
Get the Detected HTML version for the specified document. */
 PHP_FUNCTION(tidy_get_html_ver)
 {
@@ -1306,7 +1306,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_is_xhtml()
+/* {{{ proto bool tidy_is_xhtml() U
Indicates if the document is a XHTML document. */
 PHP_FUNCTION(tidy_is_xhtml)
 {
@@ -1316,7 +1316,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_is_xhtml()
+/* {{{ proto bool tidy_is_xhtml() U
Indicates if the document is a generic (non HTML/XHTML) XML document. */
 PHP_FUNCTION(tidy_is_xml)
 {
@@ -1326,7 +1326,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_error_count()
+/* {{{ proto int tidy_error_count() U
Returns the Number of Tidy errors encountered for specified document. */
 PHP_FUNCTION(tidy_error_count)
 {
@@ -1336,7 +1336,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_warning_count()
+/* {{{ proto int tidy_warning_count() U
Returns the Number of Tidy warnings encountered for specified document. */
 PHP_FUNCTION(tidy_warning_count)
 {
@@ -1346,7 +1346,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_access_count()
+/* {{{ proto int tidy_access_count() U
Returns the Number of Tidy accessibility warnings encountered for specified 
document. */
 PHP_FUNCTION(tidy_access_count)
 {
@@ -1356,7 +1356,7 @@
 }
 /* }}} */
 
-/* {{{ proto int tidy_config_count()
+/* {{{ proto int tidy_config_count() U
Returns the Number of Tidy configuration errors encountered for specified 
document. */
 PHP_FUNCTION(tidy_config_count)
 {
@@ -1559,7 +1559,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::hasChildren()
+/* {{{ proto bool tidyNode::hasChildren() U
Returns true if this node has children */
 TIDY_NODE_METHOD(hasChildren)
 {
@@ -1573,7 +1573,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::hasSiblings()
+/* {{{ proto bool tidyNode::hasSiblings() U
Returns true if this node has siblings */
 TIDY_NODE_METHOD(hasSiblings)
 {
@@ -1587,7 +1587,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isComment()
+/* {{{ proto bool tidyNode::isComment() U
Returns true if this node represents a comment */
 TIDY_NODE_METHOD(isComment)
 {
@@ -1601,7 +1601,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isHtml()
+/* {{{ proto bool tidyNode::isHtml() U
Returns true if this node is part of a HTML document */
 TIDY_NODE_METHOD(isHtml)
 {
@@ -1615,7 +1615,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isXhtml()
+/* {{{ proto bool tidyNode::isXhtml() U
Returns true if this node is part of a XHTML document */
 TIDY_NODE_METHOD(isXhtml)
 {
@@ -1629,7 +1629,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isXml()
+/* {{{ proto bool tidyNode::isXml() U
Returns true if this node is part of a XML document */
 TIDY_NODE_METHOD(isXml)
 {
@@ -1643,7 +1643,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isText()
+/* {{{ proto bool tidyNode::isText() U
Returns true if this node represents text (no markup) */
 TIDY_NODE_METHOD(isText)
 {
@@ -1657,7 +1657,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isJste()
+/* {{{ proto bool tidyNode::isJste() U
Returns true if this node is JSTE */
 TIDY_NODE_METHOD(isJste)
 {
@@ -1671,7 +1671,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isAsp()
+/* {{{ proto bool tidyNode::isAsp() U
Returns true if this node is ASP */
 TIDY_NODE_METHOD(isAsp)
 {
@@ -1685,7 +1685,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidyNode::isPhp()
+/* 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-25 Thread Nuno Lopes
nlopess Tue Apr 25 14:54:33 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix a bunch of tests in unicode mode by fixing the config array transverser
  also fix the compiler warnings
  # Andrey: is it possible to have a zend_convert_unicode_to_ascii() function 
please? it would make this code much simpler
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.81r2=1.82diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.81 php-src/ext/tidy/tidy.c:1.82
--- php-src/ext/tidy/tidy.c:1.81Tue Apr 25 12:41:59 2006
+++ php-src/ext/tidy/tidy.c Tue Apr 25 14:54:33 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.81 2006/04/25 12:41:59 nlopess Exp $ */
+/* $Id: tidy.c,v 1.82 2006/04/25 14:54:33 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -90,9 +90,13 @@
 } else { \
 convert_to_string_ex(_val); \
 TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_P(_val)); \
-if (tidyLoadConfig(_doc, Z_STRVAL_P(_val))  0) { \
+switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
+  case -1: \
 php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', Z_STRVAL_P(_val)); \
-RETURN_FALSE; \
+break; \
+  case 1: \
+php_error_docref(NULL TSRMLS_CC, E_NOTICE, There were errors 
while parsing the configuration file '%s', Z_STRVAL_P(_val)); \
+break; \
 } \
 } \
 }
@@ -462,16 +466,7 @@
/* We can't use TIDY_APPLY_CONFIG_ZVAL() here, it uses RETURN_FALSE */
 
if (ZEND_NUM_ARGS()  1) {
-   if(Z_TYPE_P(config) == IS_ARRAY) {
-   _php_tidy_apply_config_array(doc, HASH_OF(config) 
TSRMLS_CC);
-   } else {
-   convert_to_string_ex(config);
-   TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_P(config));
-   if (tidyLoadConfig(doc, Z_STRVAL_P(config))  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Could not load configuration file '%s', Z_STRVAL_P(config));
-   RETVAL_FALSE;
-   }
-   }
+   TIDY_APPLY_CONFIG_ZVAL(doc, config);
}
 
if(enc_len) {
@@ -522,7 +517,7 @@
if (!(stream = php_stream_open_wrapper(filename, rb, 
(use_include_path ? USE_PATH : 0), NULL))) {
return NULL;
}
-   if ((*len = (int) php_stream_copy_to_mem(stream, data, 
PHP_STREAM_COPY_ALL, 0)) == 0) {
+   if ((*len = (int) php_stream_copy_to_mem(stream, (void**)data, 
PHP_STREAM_COPY_ALL, 0)) == 0) {
data = estrdup();
*len = 0;
}
@@ -889,26 +884,51 @@
 
 static int _php_tidy_apply_config_array(TidyDoc doc, HashTable *ht_options 
TSRMLS_DC)
 {
-   char *opt_name = NULL;
+   zstr opt_name;
zval **opt_val;
ulong opt_indx;
-   
+   uint opt_name_len;
+   UConverter *conv = NULL;
+   UErrorCode status = U_ZERO_ERROR;
+   zend_bool clear_str;
+
+   zend_set_converter_encoding(conv, ASCII);
+
for (zend_hash_internal_pointer_reset(ht_options);
 zend_hash_get_current_data(ht_options, (void **)opt_val) == 
SUCCESS;
 zend_hash_move_forward(ht_options)) {

-   if(zend_hash_get_current_key(ht_options, opt_name, opt_indx, 
FALSE) == FAILURE) {
+   switch (zend_hash_get_current_key_ex(ht_options, opt_name, 
opt_name_len, opt_indx, FALSE, NULL)) {
+   case HASH_KEY_IS_STRING:
+   clear_str = 0;
+   break;
+
+   case HASH_KEY_IS_UNICODE:
+   zend_convert_from_unicode(conv, (opt_name.s), 
opt_name_len, opt_name.u, opt_name_len, status);
+   if (U_FAILURE(status)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Could not convert key from the option array);
+   ucnv_close(conv);
+   return FAILURE;
+   }
+   clear_str = 1;
+   break;
+
+   case HASH_KEY_IS_LONG:
+   continue; /* ignore numeric keys */
+
+   default:
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 
retrieve key from option array);
+   ucnv_close(conv);
return FAILURE;
}
 
-   if(opt_name) {
-   _php_tidy_set_tidy_opt(doc, opt_name, *opt_val 
TSRMLS_CC);
-   opt_name = NULL;
+   _php_tidy_set_tidy_opt(doc, opt_name.s, *opt_val TSRMLS_CC);
+   if (clear_str) 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-23 Thread Nuno Lopes
nlopess Sun Apr 23 12:56:11 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  upgrade tidy_get_release() to unicode.
  #say now if anything is wrong before I start upgrading the rest of the 
functions
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.79r2=1.80diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.79 php-src/ext/tidy/tidy.c:1.80
--- php-src/ext/tidy/tidy.c:1.79Wed Apr 19 22:10:44 2006
+++ php-src/ext/tidy/tidy.c Sun Apr 23 12:56:10 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.79 2006/04/19 22:10:44 nlopess Exp $ */
+/* $Id: tidy.c,v 1.80 2006/04/23 12:56:10 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -985,7 +985,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.79 2006/04/19 22:10:44 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.80 2006/04/23 12:56:10 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1191,7 +1191,7 @@
 }
 /* }}} */
 
-/* {{{ proto string tidy_get_release()
+/* {{{ proto string tidy_get_release() U
Get release date (version) for Tidy library */
 PHP_FUNCTION(tidy_get_release)
 {
@@ -1201,7 +1201,7 @@
WRONG_PARAM_COUNT;
}
 
-   RETURN_STRING((char *)tidyReleaseDate(), 1);
+   RETURN_ASCII_STRING((char *)tidyReleaseDate(), ZSTR_DUPLICATE);
 }
 /* }}} */
 

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



Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-23 Thread Andrei Zmievski
Looks fine if you're sure that the release date string will always  
contain only ASCII characters.


-Andrei

On Apr 23, 2006, at 5:56 AM, Nuno Lopes wrote:


-/* {{{ proto string tidy_get_release()
+/* {{{ proto string tidy_get_release() U
Get release date (version) for Tidy library */
 PHP_FUNCTION(tidy_get_release)
 {
@@ -1201,7 +1201,7 @@
WRONG_PARAM_COUNT;
}

-   RETURN_STRING((char *)tidyReleaseDate(), 1);
+   RETURN_ASCII_STRING((char *)tidyReleaseDate(), ZSTR_DUPLICATE);
 }
 /* }}} */


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



Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-23 Thread Nuno Lopes

Yep it will always contain ASCII characters.
Thanks for your comment,
Nuno

- Original Message - 
Looks fine if you're sure that the release date string will always  
contain only ASCII characters.


-Andrei

On Apr 23, 2006, at 5:56 AM, Nuno Lopes wrote:


-/* {{{ proto string tidy_get_release()
+/* {{{ proto string tidy_get_release() U
Get release date (version) for Tidy library */
 PHP_FUNCTION(tidy_get_release)
 {
@@ -1201,7 +1201,7 @@
 WRONG_PARAM_COUNT;
 }

- RETURN_STRING((char *)tidyReleaseDate(), 1);
+ RETURN_ASCII_STRING((char *)tidyReleaseDate(), ZSTR_DUPLICATE);
 }
 /* }}} */


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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2006-04-19 Thread Nuno Lopes
nlopess Wed Apr 19 22:10:44 2006 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MFB: fix build with newer libtidy versions on windows
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/tidy/tidy.c?r1=1.78r2=1.79diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.78 php-src/ext/tidy/tidy.c:1.79
--- php-src/ext/tidy/tidy.c:1.78Wed Mar 29 15:08:52 2006
+++ php-src/ext/tidy/tidy.c Wed Apr 19 22:10:44 2006
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.78 2006/03/29 15:08:52 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.79 2006/04/19 22:10:44 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -36,6 +36,11 @@
 #include tidy.h
 #include buffio.h
 
+/* compatibility with older versions of libtidy */
+#ifndef TIDY_CALL
+#define TIDY_CALL
+#endif
+
 #define PHP_TIDY_MODULE_VERSION2.0
 
 /* {{{ ext/tidy macros
@@ -333,22 +338,22 @@
 ZEND_GET_MODULE(tidy)
 #endif
 
-void *php_tidy_malloc(size_t len)
+void* TIDY_CALL php_tidy_malloc(size_t len)
 {
return emalloc(len);
 }
 
-void *php_tidy_realloc(void *buf, size_t len)
+void* TIDY_CALL php_tidy_realloc(void *buf, size_t len)
 {
return erealloc(buf, len);
 }
 
-void php_tidy_free(void *buf)
+void TIDY_CALL php_tidy_free(void *buf)
 {
efree(buf);
 }
 
-void php_tidy_panic(ctmbstr msg)
+void TIDY_CALL php_tidy_panic(ctmbstr msg)
 {
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory 
for tidy! (Reason: %s), (char *)msg);
@@ -980,7 +985,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.78 2006/03/29 15:08:52 tony2001 Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.79 2006/04/19 22:10:44 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 018.phpt

2005-10-25 Thread Michael Wallner
mikeTue Oct 25 13:57:30 2005 EDT

  Added files: 
/php-src/ext/tidy/tests 018.phpt 

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix bug #34965 tidy is not binary safe
  
  http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.69r2=1.70ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.69 php-src/ext/tidy/tidy.c:1.70
--- php-src/ext/tidy/tidy.c:1.69Wed Oct 12 10:30:34 2005
+++ php-src/ext/tidy/tidy.c Tue Oct 25 13:57:28 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.69 2005/10/12 14:30:34 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.70 2005/10/25 17:57:28 mike Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -127,6 +127,18 @@
zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
}
 
+#define ADD_PROPERTY_STRINGL(_table, _key, _string, _len) \
+   { \
+   zval *tmp; \
+   MAKE_STD_ZVAL(tmp); \
+   if (_string) { \
+   ZVAL_STRINGL(tmp, (char *)_string, _len, 1); \
+   } else { \
+   ZVAL_EMPTY_STRING(tmp); \
+   } \
+   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   }
+
 #define ADD_PROPERTY_LONG(_table, _key, _long) \
{ \
zval *tmp; \
@@ -198,7 +210,7 @@
 
 /* {{{ ext/tidy prototypes
 */
-static char *php_tidy_file_to_mem(char *, zend_bool TSRMLS_DC);
+static char *php_tidy_file_to_mem(char *, zend_bool, int * TSRMLS_DC);
 static void tidy_object_free_storage(void * TSRMLS_DC);
 static zend_object_value tidy_object_new_node(zend_class_entry * TSRMLS_DC);
 static zend_object_value tidy_object_new_doc(zend_class_entry * TSRMLS_DC);
@@ -405,7 +417,7 @@
 static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool 
is_file)
 {
char *data=NULL, *arg1, *enc = NULL;
-   int arg1_len, enc_len = 0;
+   int arg1_len, enc_len = 0, data_len = 0;
zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
@@ -418,11 +430,12 @@
}

if (is_file) {
-   if (!(data = php_tidy_file_to_mem(arg1, use_include_path 
TSRMLS_CC))) {
+   if (!(data = php_tidy_file_to_mem(arg1, use_include_path, 
data_len TSRMLS_CC))) {
RETURN_FALSE;
}
} else {
data = arg1;
+   data_len = arg1_len;
}
 
doc = tidyCreate();
@@ -464,7 +477,12 @@
}

if (data) {
-   if (tidyParseString(doc, data)  0) {
+   TidyBuffer buf = {0};
+   
+   tidyBufInit(buf);
+   tidyBufAppend(buf, data, data_len);
+   
+   if (tidyParseBuffer(doc, buf)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
errbuf-bp);
RETVAL_FALSE;
} else {
@@ -472,12 +490,14 @@
TidyBuffer output = {0};
 
tidySaveBuffer (doc, output);
-   RETVAL_STRING(output.bp, 1);
+   RETVAL_STRINGL(output.bp, output.size-1, 1);
tidyBufFree(output);
} else {
RETVAL_FALSE;
}
}
+   
+   tidyBufFree(buf);
}
 
if (is_file) {
@@ -489,17 +509,17 @@
tidyRelease(doc);
 }
 
-static char *php_tidy_file_to_mem(char *filename, zend_bool use_include_path 
TSRMLS_DC)
+static char *php_tidy_file_to_mem(char *filename, zend_bool use_include_path, 
int *len TSRMLS_DC)
 {
php_stream *stream;
-   int len;
char *data = NULL;
 
if (!(stream = php_stream_open_wrapper(filename, rb, 
(use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE, NULL))) {
return NULL;
}
-   if ((len = php_stream_copy_to_mem(stream, data, PHP_STREAM_COPY_ALL, 
0)) == 0) {
+   if ((*len = (int) php_stream_copy_to_mem(stream, data, 
PHP_STREAM_COPY_ALL, 0)) == 0) {
data = estrdup();
+   *len = 0;
}
php_stream_close(stream);
 
@@ -647,7 +667,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidySaveBuffer (obj-ptdoc-doc, output);
-   ZVAL_STRINGL(out, output.bp, output.size, TRUE);
+   ZVAL_STRINGL(out, output.bp, output.size-1, TRUE);
tidyBufFree(output);
break;
 
@@ -679,7 +699,7 @@
case IS_STRING:
obj = (PHPTidyObj *)zend_object_store_get_object(in 
TSRMLS_CC);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
-

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2005-10-12 Thread Antony Dovgal
tony2001Wed Oct 12 10:30:34 2005 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MF51: make GCC happy and improve CS a bit
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.68r2=1.69ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.68 php-src/ext/tidy/tidy.c:1.69
--- php-src/ext/tidy/tidy.c:1.68Wed Oct  5 15:12:44 2005
+++ php-src/ext/tidy/tidy.c Wed Oct 12 10:30:34 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.68 2005/10/05 19:12:44 helly Exp $ */
+/* $Id: tidy.c,v 1.69 2005/10/12 14:30:34 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -962,7 +962,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.68 2005/10/05 19:12:44 helly Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.69 2005/10/12 14:30:34 tony2001 Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1207,8 +1207,9 @@
RETURN_FALSE;
}
 
-   if (optval = (char *) tidyOptGetDoc(obj-ptdoc-doc, opt))
+   if ( (optval = (char *) tidyOptGetDoc(obj-ptdoc-doc, opt)) ) {
RETURN_STRING(optval, 1);
+   }
 
RETURN_FALSE;
 }

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2005-03-20 Thread John Coggeshall
johnSun Mar 20 22:54:30 2005 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Added three new properties to the node: line, column and if it is propreitary 
or not
  
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.63r2=1.64ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.63 php-src/ext/tidy/tidy.c:1.64
--- php-src/ext/tidy/tidy.c:1.63Tue Feb  8 00:25:48 2005
+++ php-src/ext/tidy/tidy.c Sun Mar 20 22:54:29 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.63 2005/02/08 05:25:48 rasmus Exp $ */
+/* $Id: tidy.c,v 1.64 2005/03/21 03:54:29 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -143,6 +143,14 @@
zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
}
 
+#define ADD_PROPERTY_BOOL(_table, _key, _bool) \
+{ \
+   zval *tmp; \
+   MAKE_STD_ZVAL(tmp); \
+   ZVAL_BOOL(tmp, _bool); \
+   zend_hash_update(_table, #_key, sizeof(#_key), (void *)tmp, 
sizeof(zval *), NULL); \
+   }
+
 #define TIDY_SAFE_MODE_CHECK(filename) \
 if ((PG(safe_mode)  (!php_checkuid(filename, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) { 
\
RETURN_FALSE; \
@@ -720,6 +728,9 @@
 
ADD_PROPERTY_STRING(obj-std.properties, name, 
tidyNodeGetName(obj-node));
ADD_PROPERTY_LONG(obj-std.properties, type, 
tidyNodeGetType(obj-node));
+   ADD_PROPERTY_LONG(obj-std.properties, line, 
tidyNodeLine(obj-node));
+ADD_PROPERTY_LONG(obj-std.properties, column, 
tidyNodeColumn(obj-node));
+ADD_PROPERTY_BOOL(obj-std.properties, proprietary, 
tidyNodeIsProp(obj-ptdoc-doc, obj-node));
 
switch(tidyNodeGetType(obj-node)) {
case TidyNode_Root:
@@ -945,7 +956,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.63 2005/02/08 05:25:48 rasmus Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.64 2005/03/21 03:54:29 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-11-25 Thread Ilia Alshanetsky
iliaa   Thu Nov 25 18:44:21 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  CS
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.59r2=1.60ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.59 php-src/ext/tidy/tidy.c:1.60
--- php-src/ext/tidy/tidy.c:1.59Sun Nov 14 08:33:59 2004
+++ php-src/ext/tidy/tidy.c Thu Nov 25 18:44:20 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.59 2004/11/14 13:33:59 tony2001 Exp $ */
+/* $Id: tidy.c,v 1.60 2004/11/25 23:44:20 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -324,7 +324,7 @@
 
 void php_tidy_panic(ctmbstr msg)
 {
-TSRMLS_FETCH();
+   TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory 
for tidy! (Reason: %s), (char *)msg);
 }
 
@@ -334,7 +334,7 @@
zval conv = *value;
 
if (!opt) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unknown Tidy 
Configuration Option '%s', optname);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unknown Tidy 
Configuration Option '%s', optname);
return FAILURE;
}

@@ -375,7 +375,7 @@
zval_copy_ctor(conv);
convert_to_long(conv);
}
-   if (tidyOptSetBool(doc,  tidyOptGetId(opt), 
Z_LVAL(conv))) {
+   if (tidyOptSetBool(doc, tidyOptGetId(opt), 
Z_LVAL(conv))) {
return SUCCESS;
}
break;
@@ -396,9 +396,9 @@
TidyDoc doc;
TidyBuffer *errbuf;
zval *config;
-   
-TIDY_SET_CONTEXT;
-
+
+   TIDY_SET_CONTEXT;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}
@@ -428,7 +428,7 @@
TIDY_SET_DEFAULT_CONFIG(doc);

/* We can't use TIDY_APPLY_CONFIG_ZVAL() here, it uses RETURN_FALSE */
-  
+
if(Z_TYPE_P(config) == IS_ARRAY) {
_php_tidy_apply_config_array(doc, HASH_OF(config) TSRMLS_CC);
} else {
@@ -602,7 +602,7 @@
if (!object) {
ALLOC_ZVAL(object);
}
-
+
Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
object-refcount = 1;
@@ -861,7 +861,7 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 
retrieve key from option array);
return FAILURE;
}
-
+
if(opt_name) {
_php_tidy_set_tidy_opt(doc, opt_name, *opt_val 
TSRMLS_CC);
opt_name = NULL;
@@ -897,12 +897,12 @@
 
 static void tidy_globals_ctor(void *global TSRMLS_DC)
 {
-
+
 }
 
 static void tidy_globals_dtor(void *global TSRMLS_DC)
 {
-
+
 }
 
 PHP_MINIT_FUNCTION(tidy)
@@ -954,7 +954,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.59 2004/11/14 13:33:59 tony2001 Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.60 2004/11/25 23:44:20 iliaa Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1017,8 +1017,8 @@
zval *options = NULL;

PHPTidyObj *obj;
-
-TIDY_SET_CONTEXT;
+
+   TIDY_SET_CONTEXT;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zs, input, 
input_len, options, enc, enc_len) == FAILURE) {
RETURN_FALSE;
@@ -1078,7 +1078,7 @@
zval *options = NULL;

PHPTidyObj *obj;
-TIDY_SET_CONTEXT;
+   TIDY_SET_CONTEXT;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zsb, 
inputfile, input_len,
  options, enc, 
enc_len, use_include_path) == FAILURE) {
@@ -1100,7 +1100,7 @@
INIT_ZVAL(*return_value);
RETVAL_FALSE;
}
-
+
efree(contents);
 }
 /* }}} */
@@ -1124,7 +1124,7 @@
Repair a string using an optionally provided configuration file */
 PHP_FUNCTION(tidy_repair_string)
 {
-TIDY_SET_CONTEXT;
+   TIDY_SET_CONTEXT;
php_tidy_quick_repair(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE);
 }
 /* }}} */
@@ -1133,7 +1133,7 @@
Repair a file using an optionally provided configuration file */
 PHP_FUNCTION(tidy_repair_file)
 {
-TIDY_SET_CONTEXT;
+   TIDY_SET_CONTEXT;
php_tidy_quick_repair(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE);
 }
 /* }}} */
@@ -1157,8 +1157,8 @@
Get release date (version) for Tidy library */

[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 016.phpt

2004-09-26 Thread Ilia Alshanetsky
iliaa   Sun Sep 26 15:24:18 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 016.phpt 
  Log:
  Return FALSE when file cannot be found.
  Specify full paths to the files used for the test.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.57r2=1.58ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.57 php-src/ext/tidy/tidy.c:1.58
--- php-src/ext/tidy/tidy.c:1.57Wed Aug  4 12:41:13 2004
+++ php-src/ext/tidy/tidy.c Sun Sep 26 15:24:18 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.57 2004/08/04 16:41:13 zeev Exp $ */
+/* $Id: tidy.c,v 1.58 2004/09/26 19:24:18 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -952,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.57 2004/08/04 16:41:13 zeev Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.58 2004/09/26 19:24:18 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1088,7 +1088,7 @@
 
if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) 
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot Load '%s' into 
memory %s, inputfile, (use_include_path) ? (Using include path) : );
-   return;
+   RETURN_FALSE;
}
 
TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
http://cvs.php.net/diff.php/php-src/ext/tidy/tests/016.phpt?r1=1.2r2=1.3ty=u
Index: php-src/ext/tidy/tests/016.phpt
diff -u php-src/ext/tidy/tests/016.phpt:1.2 php-src/ext/tidy/tests/016.phpt:1.3
--- php-src/ext/tidy/tests/016.phpt:1.2 Wed May 19 04:45:23 2004
+++ php-src/ext/tidy/tests/016.phpt Sun Sep 26 15:24:18 2004
@@ -4,7 +4,8 @@
 ?php if (!extension_loaded(tidy)) print skip; ?
 --FILE--
 ?php
-$tidy = tidy_parse_file(ext/tidy/tests/016.html, ext/tidy/tests/016.tcfg);
+   $path = dirname(__FILE__);
+$tidy = tidy_parse_file({$path}/016.html, {$path}/016.tcfg);
tidy_clean_repair($tidy);
 echo tidy_get_output($tidy);
 ?

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-08-04 Thread Zeev Suraski
zeevWed Aug  4 12:41:13 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Update prototypes
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.56r2=1.57ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.56 php-src/ext/tidy/tidy.c:1.57
--- php-src/ext/tidy/tidy.c:1.56Tue Jul 13 22:41:53 2004
+++ php-src/ext/tidy/tidy.c Wed Aug  4 12:41:13 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.56 2004/07/14 02:41:53 john Exp $ */
+/* $Id: tidy.c,v 1.57 2004/08/04 16:41:13 zeev Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -952,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.56 2004/07/14 02:41:53 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.57 2004/08/04 16:41:13 zeev Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1472,14 +1472,14 @@
 }
 /* }}} */
 
-/* {{{ proto void tidy_node::tidy_node()
+/* {{{ proto tidyNode::tidyNode()
Constructor. */
 TIDY_NODE_METHOD(__construct)
 {  
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::hasChildren()
+/* {{{ proto boolean tidyNode::hasChildren()
Returns true if this node has children */
 TIDY_NODE_METHOD(hasChildren)
 {
@@ -1493,7 +1493,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::hasSiblings()
+/* {{{ proto boolean tidyNode::hasSiblings()
Returns true if this node has siblings */
 TIDY_NODE_METHOD(hasSiblings)
 {
@@ -1507,7 +1507,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isComment()
+/* {{{ proto boolean tidyNode::isComment()
Returns true if this node represents a comment */
 TIDY_NODE_METHOD(isComment)
 {
@@ -1521,7 +1521,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isHtml()
+/* {{{ proto boolean tidyNode::isHtml()
Returns true if this node is part of a HTML document */
 TIDY_NODE_METHOD(isHtml)
 {
@@ -1535,7 +1535,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isXhtml()
+/* {{{ proto boolean tidyNode::isXhtml()
Returns true if this node is part of a XHTML document */
 TIDY_NODE_METHOD(isXhtml)
 {
@@ -1549,7 +1549,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isXml()
+/* {{{ proto boolean tidyNode::isXml()
Returns true if this node is part of a XML document */
 TIDY_NODE_METHOD(isXml)
 {
@@ -1563,7 +1563,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isText()
+/* {{{ proto boolean tidyNode::isText()
Returns true if this node represents text (no markup) */
 TIDY_NODE_METHOD(isText)
 {
@@ -1577,7 +1577,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isJste()
+/* {{{ proto boolean tidyNode::isJste()
Returns true if this node is JSTE */
 TIDY_NODE_METHOD(isJste)
 {
@@ -1591,7 +1591,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isAsp()
+/* {{{ proto boolean tidyNode::isAsp()
Returns true if this node is ASP */
 TIDY_NODE_METHOD(isAsp)
 {
@@ -1605,7 +1605,7 @@
 }
 /* }}} */
 
-/* {{{ proto boolean tidy_node::isPhp()
+/* {{{ proto boolean tidyNode::isPhp()
Returns true if this node is PHP */
 TIDY_NODE_METHOD(isPhp)
 {

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-07-13 Thread John Coggeshall
johnTue Jul 13 22:41:53 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Changing the Tidy version to 2.0
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.55r2=1.56ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.55 php-src/ext/tidy/tidy.c:1.56
--- php-src/ext/tidy/tidy.c:1.55Thu Jun 24 10:20:59 2004
+++ php-src/ext/tidy/tidy.c Tue Jul 13 22:41:53 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.55 2004/06/24 14:20:59 iliaa Exp $ */
+/* $Id: tidy.c,v 1.56 2004/07/14 02:41:53 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -37,7 +37,7 @@
 #include tidy.h
 #include buffio.h
 
-#define PHP_TIDY_MODULE_VERSION2.0-dev
+#define PHP_TIDY_MODULE_VERSION2.0
 
 /* {{{ ext/tidy macros
 */
@@ -952,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.55 2004/06/24 14:20:59 iliaa Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.56 2004/07/14 02:41:53 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-06-24 Thread Ilia Alshanetsky
iliaa   Thu Jun 24 10:20:59 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  MFB: Fixed bug #1713 (possible crash inside tidy_get_error_buffer()).
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.54r2=1.55ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.54 php-src/ext/tidy/tidy.c:1.55
--- php-src/ext/tidy/tidy.c:1.54Tue Jun  8 10:55:14 2004
+++ php-src/ext/tidy/tidy.c Thu Jun 24 10:20:59 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.54 2004/06/08 14:55:14 iliaa Exp $ */
+/* $Id: tidy.c,v 1.55 2004/06/24 14:20:59 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -952,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.54 2004/06/08 14:55:14 iliaa Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.55 2004/06/24 14:20:59 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1042,7 +1042,11 @@
 {
TIDY_FETCH_OBJECT;
 
-   RETURN_STRING(obj-ptdoc-errbuf-bp, 1);
+   if (obj-ptdoc-errbuf  obj-ptdoc-errbuf-bp) {
+   RETURN_STRING(obj-ptdoc-errbuf-bp, 1);
+   } else {
+   RETURN_FALSE;
+   }
 }
 /* }}} */
 

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-06-08 Thread Ilia Alshanetsky
iliaa   Tue Jun  8 10:55:14 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fixed bug #1580 (Tidy configuration settings leak memory).
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.53r2=1.54ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.53 php-src/ext/tidy/tidy.c:1.54
--- php-src/ext/tidy/tidy.c:1.53Fri May 28 16:32:52 2004
+++ php-src/ext/tidy/tidy.c Tue Jun  8 10:55:14 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.53 2004/05/28 20:32:52 john Exp $ */
+/* $Id: tidy.c,v 1.54 2004/06/08 14:55:14 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -330,39 +330,52 @@
 
 static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS_DC)
 {
-   TidyOption opt;
-   
-   opt = tidyGetOptionByName(doc, optname);
+   TidyOption opt = tidyGetOptionByName(doc, optname);
+   zval conv = *value;
 
if (!opt) {
-php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unknown Tidy Configuration Option 
'%s', optname);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unknown Tidy Configuration 
Option '%s', optname);
return FAILURE;
}

if (tidyOptIsReadOnly(opt)) {
-
-php_error_docref(NULL TSRMLS_CC, E_NOTICE, Attempting to set read-only 
option '%s', optname);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Attempting to set 
read-only option '%s', optname);
return FAILURE;
}
 
switch(tidyOptGetType(opt)) {
case TidyString:
-   convert_to_string_ex(value);
-   if (tidyOptSetValue(doc, tidyOptGetId(opt), 
Z_STRVAL_P(value))) {
+   if (Z_TYPE(conv) != IS_STRING) {
+   zval_copy_ctor(conv);
+   convert_to_string(conv);
+   }
+   if (tidyOptSetValue(doc, tidyOptGetId(opt), Z_STRVAL(conv))) {
+   if (Z_TYPE(conv) != Z_TYPE_P(value)) {
+   zval_dtor(conv);
+   }
return SUCCESS;
}
+   if (Z_TYPE(conv) != Z_TYPE_P(value)) {
+   zval_dtor(conv);
+   }
break;
 
case TidyInteger:
-   convert_to_long_ex(value);
-   if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL_P(value))) {
+   if (Z_TYPE(conv) != IS_LONG) {
+   zval_copy_ctor(conv);
+   convert_to_long(conv);
+   }
+   if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) {
return SUCCESS;
}
break;
 
case TidyBoolean:
-   convert_to_long_ex(value);
-   if (tidyOptSetBool(doc,  tidyOptGetId(opt), Z_LVAL_P(value))) {
+   if (Z_TYPE(conv) != IS_LONG) {
+   zval_copy_ctor(conv);
+   convert_to_long(conv);
+   }
+   if (tidyOptSetBool(doc,  tidyOptGetId(opt), Z_LVAL(conv))) {
return SUCCESS;
}
break;
@@ -371,7 +384,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to 
determine type of configuration option);
break;
}   
-   
+
return FAILURE;
 }
 
@@ -939,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.53 2004/05/28 20:32:52 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.54 2004/06/08 14:55:14 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-05-28 Thread John Coggeshall
johnFri May 28 16:32:52 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  'tidy' should not be final, but 'tidyNode' should be. 
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.52r2=1.53ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.52 php-src/ext/tidy/tidy.c:1.53
--- php-src/ext/tidy/tidy.c:1.52Sun May 23 13:22:21 2004
+++ php-src/ext/tidy/tidy.c Fri May 28 16:32:52 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.52 2004/05/23 17:22:21 iliaa Exp $ */
+/* $Id: tidy.c,v 1.53 2004/05/28 20:32:52 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -93,13 +93,13 @@
 } \
 }
 
-#define REGISTER_TIDY_CLASS(classname, name, parent) \
+#define REGISTER_TIDY_CLASS(classname, name, parent, __flags) \
{ \
zend_class_entry ce; \
INIT_CLASS_ENTRY(ce, # classname, tidy_funcs_ ## name); \
ce.create_object = tidy_object_new_ ## name; \
tidy_ce_ ## name = zend_register_internal_class_ex(ce, parent, NULL 
TSRMLS_CC); \
-   tidy_ce_ ## name-ce_flags |= ZEND_ACC_FINAL_CLASS; \
+   tidy_ce_ ## name-ce_flags |= __flags;  \
memcpy(tidy_object_handlers_ ## name, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers)); \
tidy_object_handlers_ ## name.clone_obj = NULL; \
}
@@ -895,8 +895,8 @@
ZEND_INIT_MODULE_GLOBALS(tidy, tidy_globals_ctor, tidy_globals_dtor);
 
REGISTER_INI_ENTRIES();
-   REGISTER_TIDY_CLASS(tidy, doc,  NULL);
-   REGISTER_TIDY_CLASS(tidyNode, node, NULL);
+   REGISTER_TIDY_CLASS(tidy, doc,  NULL, 0);
+   REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS);
/* no exceptions for now..
REGISTER_TIDY_CLASS(tidyException, exception,   zend_exception_get_default());
*/
@@ -939,7 +939,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.52 2004/05/23 17:22:21 iliaa Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.53 2004/05/28 20:32:52 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-05-23 Thread Ilia Alshanetsky
iliaa   Sun May 23 13:22:22 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fixed leaks on fatal errors in tidy.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.51r2=1.52ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.51 php-src/ext/tidy/tidy.c:1.52
--- php-src/ext/tidy/tidy.c:1.51Tue May 11 11:59:07 2004
+++ php-src/ext/tidy/tidy.c Sun May 23 13:22:21 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.51 2004/05/11 15:59:07 iliaa Exp $ */
+/* $Id: tidy.c,v 1.52 2004/05/23 17:22:21 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -403,6 +403,9 @@
tidyBufInit(errbuf);

if (tidySetErrorBuffer(doc, errbuf) != 0) {
+   tidyBufFree(errbuf);
+   efree(errbuf);
+   tidyRelease(doc);
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not set Tidy error 
buffer);
}

@@ -524,6 +527,11 @@
tidyBufInit(intern-ptdoc-errbuf);
 
if (tidySetErrorBuffer(intern-ptdoc-doc, 
intern-ptdoc-errbuf) != 0) {
+   tidyBufFree(intern-ptdoc-errbuf);
+   efree(intern-ptdoc-errbuf);
+   tidyRelease(intern-ptdoc-doc);
+   efree(intern-ptdoc);
+   efree(intern);
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 
set Tidy error buffer);
}
 
@@ -931,7 +939,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.51 2004/05/11 15:59:07 iliaa Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.52 2004/05/23 17:22:21 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-05-11 Thread Ilia Alshanetsky
iliaa   Tue May 11 11:59:07 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Reset opt_name to NULL to ensure it's not re-used if numeric keys can be
  found inside the options array.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.50r2=1.51ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.50 php-src/ext/tidy/tidy.c:1.51
--- php-src/ext/tidy/tidy.c:1.50Sun May  9 10:00:14 2004
+++ php-src/ext/tidy/tidy.c Tue May 11 11:59:07 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.50 2004/05/09 14:00:14 john Exp $ */
+/* $Id: tidy.c,v 1.51 2004/05/11 15:59:07 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -841,6 +841,7 @@
 
if(opt_name) {
_php_tidy_set_tidy_opt(doc, opt_name, *opt_val TSRMLS_CC);
+   opt_name = NULL;
}

}
@@ -930,7 +931,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.50 2004/05/09 14:00:14 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.51 2004/05/11 15:59:07 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-20 Thread John Coggeshall
johnTue Apr 20 14:28:09 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  No need for exception function, and renamed the 'error_buf' prop to
  errorBuffer to conform with the rest of the ext.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.48 php-src/ext/tidy/tidy.c:1.49
--- php-src/ext/tidy/tidy.c:1.48Mon Apr 19 20:26:48 2004
+++ php-src/ext/tidy/tidy.c Tue Apr 20 14:28:09 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.48 2004/04/20 00:26:48 iliaa Exp $ */
+/* $Id: tidy.c,v 1.49 2004/04/20 18:28:09 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -93,8 +93,6 @@
 } \
 }
 
-#define TIDY_THROW _php_tidy_throw_exception
-
 #define REGISTER_TIDY_CLASS(classname, name, parent) \
{ \
zend_class_entry ce; \
@@ -330,27 +328,6 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory for tidy! 
(Reason: %s), (char *)msg);
 }
 
-static void _php_tidy_throw_exception(char *message, ...)
-{
-   char *msg;
-   va_list ap;
-   
-   TSRMLS_FETCH();
-
-   va_start(ap, message);
-   vspprintf(msg, 0, message, ap);
-   
-if(TG(inst)) {
-zend_throw_exception(tidy_ce_exception, msg, 0 TSRMLS_CC);
-} else {
-php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, msg);
-}
-   
-va_end(ap);
-   efree(msg);
-   
-}
-
 static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS_DC)
 {
TidyOption opt;
@@ -486,7 +463,7 @@
int len;
char *data = NULL;
 
-   if (!(stream = php_stream_open_wrapper(filename, rb, (use_include_path ? 
USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) {
+   if (!(stream = php_stream_open_wrapper(filename, rb, (use_include_path ? 
USE_PATH : 0) | ENFORCE_SAFE_MODE, NULL))) {
return NULL;
}
if ((len = php_stream_copy_to_mem(stream, data, PHP_STREAM_COPY_ALL, 0)) == 
0) {
@@ -693,7 +670,7 @@
if (obj-ptdoc-errbuf-size) {
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, obj-ptdoc-errbuf-bp, obj-ptdoc-errbuf-size, 
TRUE);
-   zend_hash_update(obj-std.properties, error_buf, 
sizeof(error_buf), (void *)temp, sizeof(zval *), NULL);
+   zend_hash_update(obj-std.properties, errorBuffer, 
sizeof(errorBuffer), (void *)temp, sizeof(zval *), NULL);
}
 }
 
@@ -777,7 +754,7 @@
break;
 
case is_doc:
-   ADD_PROPERTY_NULL(obj-std.properties, error_buf);
+   ADD_PROPERTY_NULL(obj-std.properties, errorBuffer);
ADD_PROPERTY_NULL(obj-std.properties, value);
break;
 
@@ -952,7 +929,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.48 2004/04/20 00:26:48 iliaa Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.49 2004/04/20 18:28:09 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-19 Thread Ilia Alshanetsky
iliaa   Mon Apr 19 20:26:49 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fixed compiler warnings.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.47r2=1.48ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.47 php-src/ext/tidy/tidy.c:1.48
--- php-src/ext/tidy/tidy.c:1.47Sun Apr 18 03:58:18 2004
+++ php-src/ext/tidy/tidy.c Mon Apr 19 20:26:48 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $ */
+/* $Id: tidy.c,v 1.48 2004/04/20 00:26:48 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -343,7 +343,7 @@
 if(TG(inst)) {
 zend_throw_exception(tidy_ce_exception, msg, 0 TSRMLS_CC);
 } else {
-php_error_docref(NULL TSRMLS_CC, E_WARNING, msg);
+php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, msg);
 }

 va_end(ap);
@@ -952,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.48 2004/04/20 00:26:48 iliaa Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -987,7 +987,7 @@
 
if (input_len  1) {
if (tidyParseString(doc, input)  0 || tidyCleanAndRepair(doc)  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, errbuf.bp);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, errbuf.bp);
RETVAL_NULL();
} else {
TidyBuffer output = {0};

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 007.phpt

2004-04-18 Thread John Coggeshall
johnSun Apr 18 03:58:19 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 007.phpt 
  Log:
  Fixing a tidy_getopt() bug, and converting all exceptions to E_WARNING
  
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.46r2=1.47ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.46 php-src/ext/tidy/tidy.c:1.47
--- php-src/ext/tidy/tidy.c:1.46Fri Apr 16 17:51:59 2004
+++ php-src/ext/tidy/tidy.c Sun Apr 18 03:58:18 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.46 2004/04/16 21:51:59 john Exp $ */
+/* $Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -293,9 +293,7 @@
 static zend_object_handlers tidy_object_handlers_exception;
 
 zend_module_entry tidy_module_entry = {
-#if ZEND_MODULE_API_NO = 20010901
STANDARD_MODULE_HEADER,
-#endif
tidy,
tidy_functions,
PHP_MINIT(tidy),
@@ -303,9 +301,7 @@
PHP_RINIT(tidy),
PHP_RSHUTDOWN(tidy),
PHP_MINFO(tidy),
-#if ZEND_MODULE_API_NO = 20010901
PHP_TIDY_MODULE_VERSION,
-#endif
STANDARD_MODULE_PROPERTIES
 };
 
@@ -395,7 +391,7 @@
break;
 
default:
-   TIDY_THROW(Unable to determine type of configuration option);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to 
determine type of configuration option);
break;
}   

@@ -446,14 +442,14 @@
convert_to_string_ex(config);
TIDY_SAFE_MODE_CHECK(Z_STRVAL_P(config));
if (tidyLoadConfig(doc, Z_STRVAL_P(config))  0) {
-   TIDY_THROW(Could not load configuration file '%s', 
Z_STRVAL_P(config));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', Z_STRVAL_P(config));
RETVAL_FALSE;
}
}
 
if(enc_len) {
if (tidySetCharEncoding(doc, enc)  0) {
-   TIDY_THROW(Could not set encoding '%s', enc);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not set 
encoding '%s', enc);
RETVAL_FALSE;
}
}
@@ -879,13 +875,13 @@
 {  
if(enc) {
if (tidySetCharEncoding(obj-ptdoc-doc, enc)  0) {
-   TIDY_THROW(Could not set encoding '%s', enc);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not set 
encoding '%s', enc);
return FAILURE;
}
}

if (tidyParseString(obj-ptdoc-doc, string)  0) {
-   TIDY_THROW(%s, obj-ptdoc-errbuf-bp);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
obj-ptdoc-errbuf-bp);
return FAILURE;

} else {
@@ -956,7 +952,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.46 2004/04/16 21:51:59 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -991,7 +987,7 @@
 
if (input_len  1) {
if (tidyParseString(doc, input)  0 || tidyCleanAndRepair(doc)  0) {
-   TIDY_THROW(errbuf.bp);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, errbuf.bp);
RETVAL_NULL();
} else {
TidyBuffer output = {0};
@@ -1087,7 +1083,7 @@
obj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC);
 
if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) 
{
-   TIDY_THROW(Cannot Load '%s' into memory %s, inputfile, 
(use_include_path) ? (Using include path) : );
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot Load '%s' into 
memory %s, inputfile, (use_include_path) ? (Using include path) : );
return;
}
 
@@ -1312,7 +1308,7 @@
opt = tidyGetOptionByName(obj-ptdoc-doc, optname);
 
if (!opt) {
-   TIDY_THROW(Unknown Tidy Configuration Option '%s', optname);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown Tidy 
Configuration Option '%s', optname);
RETURN_FALSE;
}
 
@@ -1330,12 +1326,12 @@
if (optval) {
RETURN_TRUE;
} else {
-   RETURN_NULL();
+  

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread John Coggeshall
johnFri Apr 16 11:46:42 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Modified error handling:
  
- Trivial errors have been reduced to E_NOTICEs if possible
- Bad, but not script-stopping errors (i.e. file not file) are E_WARNING
- Truly bad things that make the extension unusable are not E_ERROR

Exceptions are thrown only in a OO context for E_WARNINGs.

  
  http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.43r2=1.44ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.43 php-src/ext/tidy/tidy.c:1.44
--- php-src/ext/tidy/tidy.c:1.43Wed Apr 14 15:01:45 2004
+++ php-src/ext/tidy/tidy.c Fri Apr 16 11:46:41 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.43 2004/04/14 19:01:45 fmk Exp $ */
+/* $Id: tidy.c,v 1.44 2004/04/16 15:46:41 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -153,7 +153,7 @@
 #define TIDY_SET_DEFAULT_CONFIG(_doc) \
if (TG(default_config)  TG(default_config)[0]) { \
if (tidyLoadConfig(_doc, TG(default_config))  0) { \
-   zend_error(E_ERROR, Unable to load Tidy configuration file at 
'%s'., TG(default_config)); \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to load 
Tidy configuration file at '%s'., TG(default_config)); \
} \
}
 /* }}} */
@@ -238,7 +238,7 @@
PHP_FE(tidy_error_count,NULL)
PHP_FE(tidy_warning_count,  NULL)
PHP_FE(tidy_access_count,   NULL)
-   PHP_FE(tidy_config_count,   NULL)
+   PHP_FE(tidy_config_count,   NULL) 
PHP_FE(tidy_get_root,   NULL)
PHP_FE(tidy_get_head,   NULL)
PHP_FE(tidy_get_html,   NULL)
@@ -330,7 +330,7 @@
 
 void php_tidy_panic(ctmbstr msg)
 {
-   zend_error(E_ERROR, Could not allocate memory for tidy! (Reason: %s), (char 
*)msg);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory for tidy! 
(Reason: %s), (char *)msg);
 }
 
 static void _php_tidy_throw_exception(char *message, ...)
@@ -346,7 +346,7 @@
 if(TG(inst)) {
 zend_throw_exception(tidy_ce_exception, msg, 0 TSRMLS_CC);
 } else {
-php_error_docref(NULL TSRMLS_CC, E_ERROR, msg);
+php_error_docref(NULL TSRMLS_CC, E_WARNING, msg);
 }

 va_end(ap);
@@ -361,12 +361,13 @@
opt = tidyGetOptionByName(doc, optname);
 
if (!opt) {
-   TIDY_THROW(Unknown Tidy Configuration Option '%s', optname);
+php_error_docref(NULL TSRMLS_CC, E_NOTICE, Unknown Tidy Configuration Option 
'%s', optname);
return FAILURE;
}

if (tidyOptIsReadOnly(opt)) {
-   TIDY_THROW(Attempt to set read-only option '%s', optname);
+
+php_error_docref(NULL TSRMLS_CC, E_NOTICE, Attempting to set read-only 
option '%s', optname);
return FAILURE;
}
 
@@ -409,6 +410,8 @@
TidyBuffer *errbuf;
zval *config;

+TIDY_SET_CONTEXT;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zsb, arg1, 
arg1_len, config, enc, enc_len, use_include_path) == FAILURE) {
RETURN_FALSE;
}
@@ -426,7 +429,7 @@
tidyBufInit(errbuf);

if (tidySetErrorBuffer(doc, errbuf) != 0) {
-   zend_error(E_ERROR, Could not set Tidy error buffer);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not set Tidy error 
buffer);
}

tidyOptSetBool(doc, TidyForceOutput, yes);
@@ -442,7 +445,7 @@
convert_to_string_ex(config);
TIDY_SAFE_MODE_CHECK(Z_STRVAL_P(config));
if (tidyLoadConfig(doc, Z_STRVAL_P(config))  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', Z_STRVAL_P(config));
+   TIDY_THROW(Could not load configuration file '%s', 
Z_STRVAL_P(config));
RETVAL_FALSE;
}
}
@@ -547,7 +550,7 @@
tidyBufInit(intern-ptdoc-errbuf);
 
if (tidySetErrorBuffer(intern-ptdoc-doc, 
intern-ptdoc-errbuf) != 0) {
-   zend_error(E_ERROR, Could not set Tidy error buffer);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 
set Tidy error buffer);
}
 
tidyOptSetBool(intern-ptdoc-doc, TidyForceOutput, yes);
@@ -858,9 +861,10 @@
 zend_hash_move_forward(ht_options)) {

if(zend_hash_get_current_key(ht_options, opt_name, opt_indx, FALSE) 
== FAILURE) {
-   TIDY_THROW(Could not retrieve key from option array);
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not 

[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread Derick Rethans
derick  Fri Apr 16 14:55:19 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  - Fix initializations
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.44r2=1.45ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.44 php-src/ext/tidy/tidy.c:1.45
--- php-src/ext/tidy/tidy.c:1.44Fri Apr 16 11:46:41 2004
+++ php-src/ext/tidy/tidy.c Fri Apr 16 14:55:19 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.44 2004/04/16 15:46:41 john Exp $ */
+/* $Id: tidy.c,v 1.45 2004/04/16 18:55:19 derick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -955,7 +955,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.44 2004/04/16 15:46:41 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.45 2004/04/16 18:55:19 derick Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1344,8 +1344,8 @@
 
 TIDY_DOC_METHOD(__construct)
 {
-   char *inputfile, *enc = NULL;
-   int input_len, enc_len = 0;
+   char *inputfile = NULL, *enc = NULL;
+   int input_len = 0, enc_len = 0;
zend_bool use_include_path = 0;
char *contents;
zval *options = NULL;

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread John Coggeshall
johnFri Apr 16 17:52:00 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fixed construct bug and Windows build.
  
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.45r2=1.46ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.45 php-src/ext/tidy/tidy.c:1.46
--- php-src/ext/tidy/tidy.c:1.45Fri Apr 16 14:55:19 2004
+++ php-src/ext/tidy/tidy.c Fri Apr 16 17:51:59 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.45 2004/04/16 18:55:19 derick Exp $ */
+/* $Id: tidy.c,v 1.46 2004/04/16 21:51:59 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -330,6 +330,7 @@
 
 void php_tidy_panic(ctmbstr msg)
 {
+TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory for tidy! 
(Reason: %s), (char *)msg);
 }
 
@@ -955,7 +956,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.45 2004/04/16 18:55:19 derick Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.46 2004/04/16 21:51:59 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1360,17 +1361,20 @@

obj = (PHPTidyObj *)zend_object_store_get_object(object TSRMLS_CC);

-   if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) 
{
-   TIDY_THROW(Cannot Load '%s' into memory %s, inputfile, 
(use_include_path) ? (Using include path) : );
-   return;
-   }
-
-   TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
+if(inputfile) {
+
+if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path 
TSRMLS_CC))) {
+TIDY_THROW(Cannot Load '%s' into memory %s, inputfile, 
(use_include_path) ? (Using include path) : );
+return;
+}
+
+TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
 
-   php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
+   php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
+   
+   efree(contents);
+}

-   efree(contents);
-
 }
 
 TIDY_DOC_METHOD(parseFile)

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



Re: [PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-16 Thread Derick Rethans
On Fri, 16 Apr 2004, John Coggeshall wrote:

  {
 +TSRMLS_FETCH();
   php_error_docref(NULL TSRMLS_CC, E_ERROR, Could not allocate memory for tidy! 
 (Reason: %s), (char *)msg);
  }

spaces = tabs ?

and here too:

 - TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);
 +if(inputfile) {
 +
 +if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path 
 TSRMLS_CC))) {
 +TIDY_THROW(Cannot Load '%s' into memory %s, inputfile, 
 (use_include_path) ? (Using include path) : );
 +return;
 +}
 +
 +TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);

 - php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
 + php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
 +
 + efree(contents);
 +}

 - efree(contents);
 -
  }

  TIDY_DOC_METHOD(parseFile)



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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-04-14 Thread Frank M. Kromann
fmk Wed Apr 14 15:01:46 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Declare variables before calling functions. This makes tidy compile on Win32.
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.42r2=1.43ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.42 php-src/ext/tidy/tidy.c:1.43
--- php-src/ext/tidy/tidy.c:1.42Sun Apr 11 23:14:19 2004
+++ php-src/ext/tidy/tidy.c Wed Apr 14 15:01:45 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.42 2004/04/12 03:14:19 john Exp $ */
+/* $Id: tidy.c,v 1.43 2004/04/14 19:01:45 fmk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -55,8 +55,8 @@
 object = TG(inst)

 #define TIDY_FETCH_OBJECT  \
-   TIDY_SET_CONTEXT; \
PHPTidyObj *obj;\
+   TIDY_SET_CONTEXT; \
if (object) {   \
if (ZEND_NUM_ARGS()) {  \
WRONG_PARAM_COUNT;  \
@@ -69,8 +69,8 @@
obj = (PHPTidyObj *) zend_object_store_get_object(object TSRMLS_CC);\
 
 #define TIDY_FETCH_ONLY_OBJECT \
-   TIDY_SET_CONTEXT; \
PHPTidyObj *obj;\
+   TIDY_SET_CONTEXT; \
if (ZEND_NUM_ARGS()) {  \
WRONG_PARAM_COUNT;  \
}   \
@@ -951,7 +951,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.42 2004/04/12 03:14:19 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.43 2004/04/14 19:01:45 fmk Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -1274,15 +1274,14 @@
 /* {{{ proto mixed tidy_getopt(string option)
Returns the value of the specified configuration option for the tidy document. */
 PHP_FUNCTION(tidy_getopt)
-{
-   TIDY_SET_CONTEXT;
-
+{  
PHPTidyObj *obj;
char *optname;
void *optval;
int optname_len;
TidyOption opt;
TidyOptionType optt;
+   TIDY_SET_CONTEXT;
 
if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, optname, 
optname_len) == FAILURE) {
@@ -1337,9 +1336,8 @@
char *contents;
zval *options = NULL;

-TIDY_SET_CONTEXT;
-   
PHPTidyObj *obj;
+TIDY_SET_CONTEXT;  

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |szsb, inputfile, 
input_len,
  options, enc, enc_len, 
use_include_path) == FAILURE) {

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-02-26 Thread Jani Taskinen
sniper  Thu Feb 26 08:22:11 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  Fix typo
  
http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.40r2=1.41ty=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.40 php-src/ext/tidy/tidy.c:1.41
--- php-src/ext/tidy/tidy.c:1.40Sun Feb 22 19:59:29 2004
+++ php-src/ext/tidy/tidy.c Thu Feb 26 08:22:11 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.40 2004/02/23 00:59:29 sniper Exp $ */
+/* $Id: tidy.c,v 1.41 2004/02/26 13:22:11 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -34,8 +34,8 @@
 #include Zend/zend_exceptions.h
 #include Zend/zend_object_handlers.h
 
-#include tidy/tidy.h
-#include tidy/buffio.h
+#include tidy.h
+#include buffio.h
 
 #define PHP_TIDY_MODULE_VERSION2.0-dev
 
@@ -948,7 +948,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.40 2004/02/23 00:59:29 sniper Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.41 2004/02/26 13:22:11 sniper Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-01-14 Thread Wez Furlong
wez Wed Jan 14 07:19:18 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix crash when throwing an exception
  
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.34 php-src/ext/tidy/tidy.c:1.35
--- php-src/ext/tidy/tidy.c:1.34Wed Jan 14 03:15:57 2004
+++ php-src/ext/tidy/tidy.c Wed Jan 14 07:19:17 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.34 2004/01/14 08:15:57 john Exp $ */
+/* $Id: tidy.c,v 1.35 2004/01/14 12:19:17 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -768,7 +768,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char *)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.34 2004/01/14 08:15:57 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.35 2004/01/14 12:19:17 wez Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -897,6 +897,7 @@
 
if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) 
{
TIDY_THROW(Cannot Load '%s' into memory %s, inputfile, 
(use_include_path) ? (Using include path) : );
+   return;
}
 
TIDY_APPLY_CONFIG_ZVAL(obj-ptdoc-doc, options);

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-01-08 Thread John Coggeshall
johnThu Jan  8 04:21:06 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  tidy_repair_string/file() don't get called from an existing tidy resource.
  
  
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.31 php-src/ext/tidy/tidy.c:1.32
--- php-src/ext/tidy/tidy.c:1.31Thu Jan  8 03:17:41 2004
+++ php-src/ext/tidy/tidy.c Thu Jan  8 04:21:05 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.31 2004/01/08 08:17:41 andi Exp $ */
+/* $Id: tidy.c,v 1.32 2004/01/08 09:21:05 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -229,23 +229,18 @@
char *data=NULL, *cfg_file=NULL, *arg1;
int cfg_file_len, arg1_len;
zend_bool use_include_path = 0;
-   zval *object = getThis();
-   PHPTidyObj *obj;
-
-   if (object) {
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|sb, arg1, 
arg1_len, cfg_file, cfg_file_len, use_include_path) == FAILURE) {
-   RETURN_FALSE;
-   }
-   } else {
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Os|sb, object, 
tidy_ce_doc,
-arg1, arg1_len, 
cfg_file, cfg_file_len, use_include_path) == FAILURE) {
-   return;
-   }
-
-   tidy_instanciate(tidy_ce_doc, return_value TSRMLS_CC);
+   TidyDoc doc;
+   TidyBuffer *errbuf;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|sb, arg1, arg1_len, 
cfg_file, cfg_file_len, use_include_path) == FAILURE) {
+   RETURN_FALSE;
}
-
-   obj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC);
+   
+   if (getThis()) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot call this function 
from an object context);
+   RETURN_FALSE;
+   
+   } 
 
if (is_file) {
if (!(data = php_tidy_file_to_mem(arg1, use_include_path TSRMLS_CC))) {
@@ -255,24 +250,36 @@
data = arg1;
}
 
+   doc = tidyCreate();
+   errbuf = emalloc(sizeof(TidyBuffer));
+   tidyBufInit(errbuf);
+   
+   if (tidySetErrorBuffer(doc, errbuf) != 0) {
+   zend_error(E_ERROR, Could not set Tidy error buffer);
+   }
+   
+   tidyOptSetBool(doc, TidyForceOutput, yes);
+   tidyOptSetBool(doc, TidyMark, no);
+   
+   TIDY_SET_DEFAULT_CONFIG(doc);
+   
if (cfg_file  cfg_file[0]) {
TIDY_SAFE_MODE_CHECK(cfg_file);
-   if (tidyLoadConfig(obj-ptdoc-doc, cfg_file)  0) {
+   if (tidyLoadConfig(doc, cfg_file)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not load 
configuration file '%s', cfg_file);
RETVAL_FALSE;
}
}
 
if (data) {
-   if (tidyParseString(obj-ptdoc-doc, data)  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
obj-ptdoc-errbuf-bp);
+   if (tidyParseString(doc, data)  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, errbuf-bp);
RETVAL_FALSE;
} else {
-   obj-ptdoc-parsed = TRUE;
-   if (tidyCleanAndRepair(obj-ptdoc-doc) = 0) {
+   if (tidyCleanAndRepair(doc) = 0) {
TidyBuffer output = {0};
 
-   tidySaveBuffer (obj-ptdoc-doc, output);
+   tidySaveBuffer (doc, output);
RETVAL_STRING(output.bp, 1);
tidyBufFree(output);
} else {
@@ -284,6 +291,10 @@
if (is_file) {
efree(data);
}
+   
+   tidyBufFree(errbuf);
+   efree(errbuf);
+   tidyRelease(doc);
 }
 
 static char *php_tidy_file_to_mem(char *filename, zend_bool use_include_path 
TSRMLS_DC)
@@ -811,7 +822,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Library Version, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.31 2004/01/08 08:17:41 andi Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.32 2004/01/08 09:21:05 john Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c

2004-01-06 Thread Jani Taskinen
sniper  Tue Jan  6 17:23:37 2004 EDT

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  no need for double #include of same header file
  
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.28 php-src/ext/tidy/tidy.c:1.29
--- php-src/ext/tidy/tidy.c:1.28Tue Jan  6 13:24:17 2004
+++ php-src/ext/tidy/tidy.c Tue Jan  6 17:23:36 2004
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.28 2004/01/06 18:24:17 john Exp $ */
+/* $Id: tidy.c,v 1.29 2004/01/06 22:23:36 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -29,12 +29,11 @@
 
 #include php_ini.h
 #include ext/standard/info.h
+#include safe_mode.h
 #include Zend/zend_API.h
 #include Zend/zend_hash.h
-#include safe_mode.h
 #include Zend/zend_default_classes.h
 #include Zend/zend_object_handlers.h
-#include Zend/zend_hash.h
 
 ZEND_DECLARE_MODULE_GLOBALS(tidy)
 
@@ -808,7 +807,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Library Version, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.28 2004/01/06 18:24:17 john Exp $));
+   php_info_print_table_row(2, Extension Version, PHP_TIDY_MODULE_VERSION  
($Id: tidy.c,v 1.29 2004/01/06 22:23:36 sniper Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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