summaryrefslogtreecommitdiff
path: root/ext/mbstring
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-07-18 21:24:28 +0200
committerNikita Popov <nikic@php.net>2015-07-18 21:53:03 +0200
commitf809f2811964f216018f2ff7623d779991854252 (patch)
tree96a90b1cb84672eb83d88ab21773f2007359c020 /ext/mbstring
parent4ac0d96faaaaa718a1d66e194c407324fd8fee32 (diff)
downloadphp-git-f809f2811964f216018f2ff7623d779991854252.tar.gz
Check mbfl_filt_put_invalid_char return value
And fix some libmbfl warnings
Diffstat (limited to 'ext/mbstring')
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c2
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_utf8.c15
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c14
3 files changed, 16 insertions, 15 deletions
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
index a5260807d4..e0d5543882 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
@@ -48,7 +48,7 @@ const mbfl_encoding mbfl_encoding_2022jp_kddi = {
mbfl_no_encoding_2022jp_kddi,
"ISO-2022-JP-MOBILE#KDDI",
"ISO-2022-JP",
- mbfl_encoding_2022jp_kddi_aliases,
+ &mbfl_encoding_2022jp_kddi_aliases,
NULL,
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE
};
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
index a9c141bbfe..e81e0860d2 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
@@ -101,6 +101,7 @@ int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
filter->status = 0;
filter->cache = 0;
CK((*filter->output_function)(w, filter->data));
+ return 0;
}
@@ -109,7 +110,7 @@ int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
*/
int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
{
- int s, c1, w = 0, flag = 0;
+ int s, c1;
retry:
switch (filter->status & 0xff) {
@@ -126,7 +127,7 @@ retry:
filter->status = 0x30;
filter->cache = c & 0x7;
} else {
- mbfl_filt_put_invalid_char(c, filter);
+ CK(mbfl_filt_put_invalid_char(c, filter));
}
break;
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
@@ -138,7 +139,7 @@ retry:
filter->cache = 0;
CK((*filter->output_function)(s, filter->data));
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -153,7 +154,7 @@ retry:
filter->cache = s;
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -168,7 +169,7 @@ retry:
filter->cache = s;
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -177,7 +178,7 @@ retry:
filter->cache = (filter->cache<<6) | (c & 0x3f);
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -200,7 +201,7 @@ int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter)
filter->cache = 0;
if (status != 0) {
- mbfl_filt_put_invalid_char(cache, filter);
+ CK(mbfl_filt_put_invalid_char(cache, filter));
}
if (filter->flush_function != NULL) {
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
index c449d3132a..41e02bf314 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.c
@@ -183,14 +183,14 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8_sb = {
};
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
+int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter);
/*
* UTF-8 => wchar
*/
int mbfl_filt_conv_utf8_mobile_wchar(int c, mbfl_convert_filter *filter)
{
- int s, w = 0, flag = 0;
- int s1 = 0, c1 = 0, snd = 0;
+ int s, s1 = 0, c1 = 0, snd = 0;
retry:
switch (filter->status & 0xff) {
@@ -207,7 +207,7 @@ retry:
filter->status = 0x30;
filter->cache = c & 0x7;
} else {
- mbfl_filt_put_invalid_char(c, filter);
+ CK(mbfl_filt_put_invalid_char(c, filter));
}
break;
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
@@ -237,7 +237,7 @@ retry:
}
CK((*filter->output_function)(s, filter->data));
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -252,7 +252,7 @@ retry:
filter->cache = s;
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -267,7 +267,7 @@ retry:
filter->cache = s;
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;
@@ -276,7 +276,7 @@ retry:
filter->cache = (filter->cache<<6) | (c & 0x3f);
filter->status++;
} else {
- mbfl_filt_put_invalid_char(filter->cache, filter);
+ CK(mbfl_filt_put_invalid_char(filter->cache, filter));
goto retry;
}
break;