From 509df14ff4975b6d94ca4c7fe82b2a8587bd12af Mon Sep 17 00:00:00 2001 From: "Den V. Tsopa" Date: Thu, 30 May 2002 10:10:16 +0000 Subject: [PATCH] Fixes some dummy errors (again). --- ext/mbstring/mbfilter_ru.c | 72 ++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/ext/mbstring/mbfilter_ru.c b/ext/mbstring/mbfilter_ru.c index 1ae391a62f..24847aed5e 100644 --- a/ext/mbstring/mbfilter_ru.c +++ b/ext/mbstring/mbfilter_ru.c @@ -74,17 +74,21 @@ mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter TSRMLS_DC) { int s, n; - s = -1; - n = cp1251_ucs_table_len-1; - while (n >= 0) { - if (c == cp1251_ucs_table[n]) { - s = cp1251_ucs_table_min + n; - break; + if (c < 0x80) { + s = c; + } else { + s = -1; + n = cp1251_ucs_table_len-1; + while (n >= 0) { + if (c == cp1251_ucs_table[n]) { + s = cp1251_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP1251) { + s = c & MBFL_WCSPLANE_MASK; } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP1251) { - s = c & MBFL_WCSPLANE_MASK; } if (s >= 0) { @@ -134,17 +138,21 @@ mbfl_filt_conv_wchar_cp866(int c, mbfl_convert_filter *filter TSRMLS_DC) { int s, n; - s = -1; - n = cp866_ucs_table_len-1; - while (n >= 0) { - if (c == cp866_ucs_table[n]) { - s = cp866_ucs_table_min + n; - break; + if (c < 0x80) { + s = c; + } else { + s = -1; + n = cp866_ucs_table_len-1; + while (n >= 0) { + if (c == cp866_ucs_table[n]) { + s = cp866_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP866) { + s = c & MBFL_WCSPLANE_MASK; } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_CP866) { - s = c & MBFL_WCSPLANE_MASK; } if (s >= 0) { @@ -194,17 +202,21 @@ mbfl_filt_conv_wchar_koi8r(int c, mbfl_convert_filter *filter TSRMLS_DC) { int s, n; - s = -1; - n = koi8r_ucs_table_len-1; - while (n >= 0) { - if (c == koi8r_ucs_table[n]) { - s = koi8r_ucs_table_min + n; - break; + if (c < 0x80) { + s = c; + } else { + s = -1; + n = koi8r_ucs_table_len-1; + while (n >= 0) { + if (c == koi8r_ucs_table[n]) { + s = koi8r_ucs_table_min + n; + break; + } + n--; + } + if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_KOI8R) { + s = c & MBFL_WCSPLANE_MASK; } - n--; - } - if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_KOI8R) { - s = c & MBFL_WCSPLANE_MASK; } if (s >= 0) { -- 2.40.0