cvs: php4 /ext/mbstring mbfilter.c mbstring.c

From: Date: Thu, 10 May 2001 13:12:03 +0000
Subject: cvs: php4 /ext/mbstring mbfilter.c mbstring.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5649@lists.php.net to get a copy of this message
hirokawa Thu May 10 06:12:03 2001 EDT Modified files: /php4/ext/mbstring mbfilter.c mbstring.c Log: fixed bug of mb_substitute_character() and mb_substr() in mbstring. Index: php4/ext/mbstring/mbfilter.c diff -u php4/ext/mbstring/mbfilter.c:1.6 php4/ext/mbstring/mbfilter.c:1.7 --- php4/ext/mbstring/mbfilter.c:1.6 Wed May 9 04:18:11 2001 +++ php4/ext/mbstring/mbfilter.c Thu May 10 06:12:03 2001 @@ -77,7 +77,7 @@ * */ -/* $Id: mbfilter.c,v 1.6 2001/05/09 11:18:11 hirokawa Exp $ */ +/* $Id: mbfilter.c,v 1.7 2001/05/10 13:12:03 hirokawa Exp $ */ #include <stdlib.h> @@ -6353,18 +6353,24 @@ p = string->val; if (p != NULL) { /* search start position */ - do { + while (k <= from) { start = n; + if (n >= len) { + break; + } m = mbtab[*p]; n += m; p += m; k++; - } while (k <= from && n < len); + } /* detect end position */ k = 0; end = start; - while (k < length && n <= len) { + while (k < length) { end = n; + if (n >= len) { + break; + } m = mbtab[*p]; n += m; p += m; @@ -6394,11 +6400,14 @@ result->len = 0; result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char)); if (w != NULL) { - result->len = n; - p = &(string->val[start]); - while (n > 0) { - *w++ = *p++; - n--; + p = string->val; + if (p != NULL) { + p += start; + result->len = n; + while (n > 0) { + *w++ = *p++; + n--; + } } *w++ = '\0'; *w++ = '\0'; Index: php4/ext/mbstring/mbstring.c diff -u php4/ext/mbstring/mbstring.c:1.12 php4/ext/mbstring/mbstring.c:1.13 --- php4/ext/mbstring/mbstring.c:1.12 Wed May 9 04:18:11 2001 +++ php4/ext/mbstring/mbstring.c Thu May 10 06:12:03 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.12 2001/05/09 11:18:11 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.13 2001/05/10 13:12:03 hirokawa Exp $ */ /* * PHP4 Multibyte String module "mbstring" (currently only for Japanese) @@ -765,6 +765,7 @@ MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1); break; } + RETVAL_TRUE; } else { WRONG_PARAM_COUNT; }

« previous php.cvs (#5649) next »