diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:28 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:28 -0400 |
commit | ba50031707469046407a35b77a3cd81351e951b3 (patch) | |
tree | 5c03e723bdbfabae09d41a3ab1253dff41eeed4a /ext/iconv/iconv.c | |
parent | 0a36161e13484a99ccf69bb38f206462d27cc6d6 (diff) | |
download | php-ba50031707469046407a35b77a3cd81351e951b3.tar.gz |
Imported Upstream version 5.1.5upstream/5.1.5
Diffstat (limited to 'ext/iconv/iconv.c')
-rw-r--r-- | ext/iconv/iconv.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index b6494d45f..b646399a2 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: iconv.c,v 1.124.2.5 2006/01/01 12:50:08 sniper Exp $ */ +/* $Id: iconv.c,v 1.124.2.8 2006/04/27 00:50:54 moriyoshi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -583,7 +583,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, size_t out_left; unsigned int cnt; - unsigned int total_len; + int total_len; err = _php_iconv_strlen(&total_len, str, nbytes, enc); if (err != PHP_ICONV_ERR_SUCCESS) { @@ -822,18 +822,16 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, j += GENERIC_SUPERSET_NBYTES; } - if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { - i = 0; - } - - if (i == 0) { - match_ofs = (unsigned int)-1; - } else { + if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES; i += GENERIC_SUPERSET_NBYTES; + ndl_buf_p = &ndl_buf[i]; + ndl_buf_left = ndl_buf_len - i; + } else { + match_ofs = (unsigned int)-1; + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; } - ndl_buf_p = &ndl_buf[i]; - ndl_buf_left = ndl_buf_len - i; } } } else { @@ -867,18 +865,16 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, j += GENERIC_SUPERSET_NBYTES; } - if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { - i = 0; - } - - if (i == 0) { - match_ofs = (unsigned int)-1; - } else { + if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES; i += GENERIC_SUPERSET_NBYTES; + ndl_buf_p = &ndl_buf[i]; + ndl_buf_left = ndl_buf_len - i; + } else { + match_ofs = (unsigned int)-1; + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; } - ndl_buf_p = &ndl_buf[i]; - ndl_buf_left = ndl_buf_len - i; } } } @@ -1395,11 +1391,13 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st case 3: /* expecting a encoding scheme specifier */ switch (*p1) { + case 'b': case 'B': enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; scan_stat = 4; break; + case 'q': case 'Q': enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT; scan_stat = 4; |