com php-src: Remove dead code from mbfilter_koi8r.c: ext/mbstring/libmbfl/filters/mbfilter_koi8r.c ext/mbstr ing/libmbfl/mbfl/mbfl_consts.h
| From: | Alex Dowad | Date: | Mon, 02 Nov 2020 19:31:06 +0000 |
| Subject: | com php-src: Remove dead code from mbfilter_koi8r.c: ext/mbstring/libmbfl/filters/mbfilter_koi8r.c ext/mbstr ing/libmbfl/mbfl/mbfl_consts.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114024@lists.php.net to get a copy of this message | ||
Commit: 0a8ebb36a58d5b1ec29897b7c04e1787a0faf063
Author: Alex Dowad <alexinbeijing@gmail.com> Sun, 18 Oct 2020 16:39:09 +0200
Parents: 7b97789ec0fbf480e7c61363df7fc9e63cbc785a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0a8ebb36a58d5b1ec29897b7c04e1787a0faf063
Log:
Remove dead code from mbfilter_koi8r.c
Changed paths:
M ext/mbstring/libmbfl/filters/mbfilter_koi8r..c
M ext/mbstring/libmbfl/mbfl/mbfl_consts.h
Diff:
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c
b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c
index 6a87377938c..5c76fc066cd 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_koi8r.c
@@ -72,62 +72,31 @@ const struct mbfl_convert_vtbl vtbl_koi8r_wchar = {
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-/*
- * koi8r => wchar
- */
-int
-mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter)
+int mbfl_filt_conv_koi8r_wchar(int c, mbfl_convert_filter *filter)
{
int s;
- if (c >= 0 && c < koi8r_ucs_table_min) {
+ if (c < koi8r_ucs_table_min) {
s = c;
- } else if (c >= koi8r_ucs_table_min && c < 0x100) {
- s = koi8r_ucs_table[c - koi8r_ucs_table_min];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_KOI8R;
- }
} else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
+ s = koi8r_ucs_table[c - koi8r_ucs_table_min];
}
CK((*filter->output_function)(s, filter->data));
-
return c;
}
-/*
- * wchar => koi8r
- */
-int
-mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter)
+int mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter)
{
- int s, n;
-
if (c < 0x80) {
- s = c;
+ CK((*filter->output_function)(c, filter->data));
} else {
- s = -1;
- n = koi8r_ucs_table_len-1;
- while (n >= 0) {
+ for (int n = 0; n < koi8r_ucs_table_len; n++) {
if (c == koi8r_ucs_table[n]) {
- s = koi8r_ucs_table_min + n;
- break;
+ CK((*filter->output_function)(koi8r_ucs_table_min + n, filter->data));
+ return c;
}
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_KOI8R) {
- s = c & MBFL_WCSPLANE_MASK;
}
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
CK(mbfl_filt_conv_illegal_output(c, filter));
}
diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
index fb309358de3..3570aa891d2 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
+++ b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
@@ -70,7 +70,6 @@
#define MBFL_WCSPLANE_BIG5 0x70f40000 /* 2121h - 9898h */
#define MBFL_WCSPLANE_CNS11643 0x70f50000 /* 2121h - 9898h */
#define MBFL_WCSPLANE_UHC 0x70f60000 /* 8141h - fefeh */
-#define MBFL_WCSPLANE_KOI8R 0x70f90000
#define MBFL_WCSPLANE_8859_16 0x70fa0000 /* 00h - FFh */
#define MBFL_WCSPLANE_ARMSCII8 0x70fb0000
#define MBFL_WCSPLANE_KOI8U 0x70fc0000