*
*/
-/*
+/*
* Unicode support
*
* Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
mbfl_buffer_converter *
mbfl_buffer_converter_new2(
const mbfl_encoding *from,
- const mbfl_encoding *to,
+ const mbfl_encoding *to,
int buf_initsz)
{
mbfl_buffer_converter *convd;
}
mbfl_string *
-mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
+mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
mbfl_string *result)
{
if (convd == NULL || string == NULL || result == NULL) {
}
n--;
}
-
+
/* fallback judge */
if (!encoding) {
n = identd->filter_list_size - 1;
}
}
}
-
+
/* cleanup */
/* dtors should be called in reverse order */
i = num; while (--i >= 0) {
}
}
}
-
+
/* cleanup */
/* dtors should be called in reverse order */
i = num; while (--i >= 0) {
} else {
/* wchar filter */
mbfl_convert_filter *filter = mbfl_convert_filter_new(
- string->no_encoding,
+ string->no_encoding,
mbfl_no_encoding_wchar,
filter_count_output, 0, &len);
if (filter == NULL) {
return len;
}
-
+
/*
* strpos
*/
/*
* oddlen
*/
-int
+int
mbfl_oddlen(mbfl_string *string)
{
int len, n, m, k;
++result;
} else if ((c & 0xc0) != 0x80) {
++result;
- }
+ }
}
goto out;
}
qe = needle_u8_val + needle_u8_len;
if (offset < 0) {
if (-offset > needle_len) {
- offset += needle_len;
+ offset += needle_len;
while (offset < 0) {
unsigned char c;
if (p <= e) {
++result;
} else if ((c & 0xc0) != 0x80) {
++result;
- }
+ }
}
goto out;
}
if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
from &= -2;
- if (from + length >= string->len) {
+ if (length >= string->len - from) {
length = string->len - from;
}
} else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
from &= -4;
- if (from + length >= string->len) {
+ if (length >= string->len - from) {
length = string->len - from;
}
start = string->val + from;
end = start + (length & -4);
} else if ((encoding->flag & MBFL_ENCTYPE_SBCS)) {
- if (from + length >= string->len) {
+ if (length >= string->len - from) {
length = string->len - from;
}
start = p;
/* search end position */
- if ((start - string->val) + length >= (int)string->len) {
+ if (length >= (int)string->len - (start - string->val)) {
end = string->val + string->len;
} else {
for (q = p + length; p < q; p += (m = mbtab[*p]));
mbfl_no_encoding_wchar,
(int(*)(int, void*))next_filter->filter_function,
(int(*)(void*))next_filter->filter_flush,
- next_filter);
+ next_filter);
if (encoder == NULL) {
goto out;
}