hirokawa Tue Mar 21 02:49:09 2006 UTC Modified files: (Branch: PHP_4_4) /php-src/ext/mbstring mbstring.c mbstring.h /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c mbfilter.h mbfl_convert.c mbfl_convert.h Log: MFH.
http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.142.2.47.2.13&r2=1.142.2.47.2.14&diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.142.2.47.2.13 php-src/ext/mbstring/mbstring.c:1.142.2.47.2.14 --- php-src/ext/mbstring/mbstring.c:1.142.2.47.2.13 Sat Mar 18 05:52:33 2006 +++ php-src/ext/mbstring/mbstring.c Tue Mar 21 02:49:09 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.142.2.47.2.13 2006/03/18 05:52:33 masugata Exp $ */ +/* $Id: mbstring.c,v 1.142.2.47.2.14 2006/03/21 02:49:09 hirokawa Exp $ */ /* * PHP4 Multibyte String module "mbstring" @@ -854,6 +854,7 @@ MBSTRG(filter_illegal_substchar) = 0x3f; /* '?' */ MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; MBSTRG(current_filter_illegal_substchar) = 0x3f; /* '?' */ + MBSTRG(illegalchars) = 0; MBSTRG(func_overload) = 0; MBSTRG(encoding_translation) = 0; pglobals->outconv = NULL; @@ -1011,6 +1012,7 @@ MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding); MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode); MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar); + MBSTRG(illegalchars) = 0; n = 0; if (MBSTRG(detect_order_list)) { @@ -1078,6 +1080,7 @@ MBSTRG(current_detect_order_list_size) = 0; } if (MBSTRG(outconv) != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -1627,6 +1630,7 @@ } if (convd != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } if (val_list != NULL) { @@ -1978,6 +1982,7 @@ PG(register_globals) = old_rg; if (convd != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } efree((void *)str_list); @@ -2015,6 +2020,7 @@ if ((arg_status & PHP_OUTPUT_HANDLER_START) != 0) { /* delete the converter just in case. */ if (MBSTRG(outconv)) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -2079,6 +2085,7 @@ /* delete the converter if it is the last feed. */ if (last_feed) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -2711,6 +2718,7 @@ output = (char *)ret->val; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); return output; } @@ -3376,6 +3384,7 @@ } efree(stack); } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } @@ -3795,6 +3804,8 @@ if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_body_encoding)) != NULL) { RETVAL_STRING(name, 1); } + } else if (!strcasecmp("illegal_chars", typ)) { + RETVAL_LONG(MBSTRG(illegalchars)); } else { RETURN_FALSE; } @@ -3961,6 +3972,7 @@ str[i] = ret->val; len[i] = ret->len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } return ret ? 0 : -1; @@ -4184,6 +4196,7 @@ *to = ret->val; *to_length = ret->len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); return ret ? 0 : -1; http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.40.2.12.4.1&r2=1.40.2.12.4.2&diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.40.2.12.4.1 php-src/ext/mbstring/mbstring.h:1.40.2.12.4.2 --- php-src/ext/mbstring/mbstring.h:1.40.2.12.4.1 Sun Jan 1 13:46:54 2006 +++ php-src/ext/mbstring/mbstring.h Tue Mar 21 02:49:09 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.h,v 1.40.2.12.4.1 2006/01/01 13:46:54 sniper Exp $ */ +/* $Id: mbstring.h,v 1.40.2.12.4.2 2006/03/21 02:49:09 hirokawa Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -176,6 +176,7 @@ int current_filter_illegal_substchar; long func_overload; zend_bool encoding_translation; + long illegalchars; mbfl_buffer_converter *outconv; #if HAVE_MBREGEX && defined(PHP_MBREGEX_GLOBALS) PHP_MBREGEX_GLOBALS http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.1.2.7.2.2&r2=1.1.2.7.2.3&diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.1.2.7.2.2 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.1.2.7.2.3 --- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.1.2.7.2.2 Fri Dec 30 05:25:54 2005 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c Tue Mar 21 02:49:09 2006 @@ -331,6 +331,20 @@ return mbfl_memory_device_result(&convd->device, result); } +int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd) +{ + int num_illegalchars = 0; + + if (convd->filter1 != NULL) { + num_illegalchars += convd->filter1->num_illegalchar; + } + + if (convd->filter2 != NULL) { + num_illegalchars += convd->filter2->num_illegalchar; + } + + return (num_illegalchars); +} /* * encoding detector http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h?r1=1.2.2.3.2.1&r2=1.2.2.3.2.2&diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.2.2.3.2.1 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.2.2.3.2.2 --- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.2.2.3.2.1 Fri Dec 30 05:25:54 2005 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h Tue Mar 21 02:49:09 2006 @@ -129,6 +129,7 @@ MBFLAPI extern mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result); MBFLAPI extern mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result); MBFLAPI extern mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result); +MBFLAPI extern int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd); /* * encoding detector http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c?r1=1.3.2.2.2.1&r2=1.3.2.2.2.2&diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.3.2.2.2.1 php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.3.2.2.2.2 --- php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.3.2.2.2.1 Fri Dec 30 05:25:54 2005 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c Tue Mar 21 02:49:09 2006 @@ -250,6 +250,7 @@ filter->data = data; filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; filter->illegal_substchar = 0x3f; /* '?' */ + filter->num_illegalchar = 0; /* setup the function table */ mbfl_convert_filter_reset_vtbl(filter); @@ -317,6 +318,7 @@ dist->to = src->to; dist->illegal_mode = src->illegal_mode; dist->illegal_substchar = src->illegal_substchar; + dist->num_illegalchar = src->num_illegalchar; } int mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src) @@ -432,7 +434,7 @@ break; } filter->illegal_mode = mode_backup; - + filter->num_illegalchar++; return ret; } http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h?r1=1.2.2.3&r2=1.2.2.3.2.1&diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h:1.2.2.3 php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h:1.2.2.3.2.1 --- php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h:1.2.2.3 Mon Feb 21 10:15:03 2005 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.h Tue Mar 21 02:49:09 2006 @@ -51,6 +51,7 @@ const mbfl_encoding *to; int illegal_mode; int illegal_substchar; + int num_illegalchar; void *opaque; };
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php