Moriyoshi Koizumi
moriy****@users*****
2004年 2月 4日 (水) 14:44:06 JST
moriyoshi 04/02/04 14:44:06 Modified: mbfl mbfilter.c Log: - The check turned out to be necessary anyway. Revision Changes Path 1.24 +15 -14 libmbfl/mbfl/mbfilter.c Index: mbfilter.c =================================================================== RCS file: /cvsroot/php-i18n/libmbfl/mbfl/mbfilter.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- mbfilter.c 4 Feb 2004 05:36:49 -0000 1.23 +++ mbfilter.c 4 Feb 2004 05:44:06 -0000 1.24 @@ -280,7 +280,6 @@ { int i, n, num, bad; unsigned char *p; - const mbfl_identify_vtbl *vtbl; mbfl_identify_filter *flist, *filter; const mbfl_encoding *encoding; @@ -303,21 +302,23 @@ n = string->len; p = string->val; - bad = 0; - while (n > 0) { - for (i = 0; i < num; i++) { - filter = &flist[i]; - (*filter->filter_function)(*p, filter); - if (filter->flag) { - bad++; + if (p != NULL) { + bad = 0; + while (n > 0) { + for (i = 0; i < num; i++) { + filter = &flist[i]; + (*filter->filter_function)(*p, filter); + if (filter->flag) { + bad++; + } + i++; } - i++; - } - if ((num - 1) <= bad) { - break; + if ((num - 1) <= bad) { + break; + } + p++; + n--; } - p++; - n--; } /* judge */