FAQ
fujimoto Fri Apr 22 01:03:25 2005 EDT

Modified files: (Branch: PHP_5_0)
/php-src/ext/mbstring/libmbfl/mbfl mbfilter.c
Log:
- MFH: Fix mbfl_encoding_detector_feed() and mbfl_mbfl_identify_encoding() behaviour


http://cvs.php.net/diff.php/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.2.2.6&r2=1.2.2.7&ty=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.2.2.6 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.2.2.7
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.2.2.6 Wed Apr 13 06:10:54 2005
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c Fri Apr 22 01:03:25 2005
@@ -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;

Search Discussions

  • Moriyoshi Koizumi at Apr 23, 2005 at 5:28 am

    On 2005/04/22, at 14:03, Masaki Fujimoto wrote:

    @@ -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;
    Looks like this hunk of the change wasn't applied to the other two.

    http://cvs.php.net/diff.php/php-src/ext/mbstring/libmbfl/mbfl/
    mbfilter.c?r1=1.6&r2=1.7&ty=u
    http://cvs.php.net/diff.php/php-src/ext/mbstring/libmbfl/mbfl/
    mbfilter.c?r1=1.1.2.6&r2=1.1.2.7&ty=u

    Just wondering which patch is correct...

    Moriyoshi
  • Masaki Fujimoto at Apr 23, 2005 at 11:09 am
    Current one should be correct (I tested all the cases with my patch).

    Actually I also wondered, but it seems that former one (I mean "for (i
    = num; --i >= 0;)" which is commited only to the PHP_5_0 branch)
    should be a trace of your first patch (in 2005/04/13).


    The Message From Moriyoshi Koizumi on Sat, 23 Apr 2005 14:27:01 +0900:
    On 2005/04/22, at 14:03, Masaki Fujimoto wrote:

    @@ -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;
    Looks like this hunk of the change wasn't applied to the other two.

    http://cvs.php.net/diff.php/php-src/ext/mbstring/libmbfl/mbfl/
    mbfilter.c?r1=1.6&r2=1.7&ty=u
    http://cvs.php.net/diff.php/php-src/ext/mbstring/libmbfl/mbfl/
    mbfilter.c?r1=1.1.2.6&r2=1.1.2.7&ty=u

    Just wondering which patch is correct...

    Moriyoshi
    --
    Masaki Fujimoto
    fujimoto@php.net

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-cvs @
categoriesphp
postedApr 22, '05 at 5:03a
activeApr 23, '05 at 11:09a
posts3
users2
websitephp.net

People

Translate

site design / logo © 2019 Grokbase