Masaki Fujimoto
fujim****@users*****
2005年 4月 22日 (金) 13:54:17 JST
fujimoto 05/04/22 13:54:17 Modified: mbfl Tag: LIBMBFL_1_0 mbfilter.c Log: - Fix mbfl_encoding_detector_feed() and mbfl_mbfl_identify_encoding() behaviour(again) Revision Changes Path No revision No revision 1.8.2.15 +13 -11 libmbfl/mbfl/mbfilter.c Index: mbfilter.c =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfilter.c,v retrieving revision 1.8.2.14 retrieving revision 1.8.2.15 diff -u -r1.8.2.14 -r1.8.2.15 --- mbfilter.c 13 Apr 2005 08:11:58 -0000 1.8.2.14 +++ mbfilter.c 22 Apr 2005 04:54:17 -0000 1.8.2.15 @@ -405,16 +405,16 @@ num = identd->filter_list_size; n = string->len; p = string->val; + bad = 0; while (n > 0) { - i = 0; - bad = 0; - while (i < num) { + for (i = 0; i < num; i++) { filter = identd->filter_list[i]; - (*filter->filter_function)(*p, filter); - if (filter->flag) { - bad++; + if (!filter->flag) { + (*filter->filter_function)(*p, filter); + if (filter->flag) { + bad++; + } } - i++; } if ((num - 1) <= bad) { res = 1; @@ -555,9 +555,11 @@ while (n > 0) { for (i = 0; i < num; i++) { filter = &flist[i]; - (*filter->filter_function)(*p, filter); - if (filter->flag) { - bad++; + if (!filter->flag) { + (*filter->filter_function)(*p, filter); + if (filter->flag) { + bad++; + } } } if ((num - 1) <= bad && !strict) { @@ -571,7 +573,7 @@ /* judge */ encoding = NULL; - for (i = num; --i >= 0;) { + for (i = 0; i < num; i++) { filter = &flist[i]; if (!filter->flag) { encoding = filter->encoding;