unicode: fix handling of short 1-4 char tables
function old new delta in_uint16_table 92 107 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
eb773054e4
commit
33e955ab91
@ -250,7 +250,6 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp)
|
|||||||
|
|
||||||
#if ENABLE_MONOTONIC_SYSCALL
|
#if ENABLE_MONOTONIC_SYSCALL
|
||||||
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
/* Old glibc (< 2.3.4) does not provide this constant. We use syscall
|
/* Old glibc (< 2.3.4) does not provide this constant. We use syscall
|
||||||
* directly so this definition is safe. */
|
* directly so this definition is safe. */
|
||||||
#ifndef CLOCK_MONOTONIC
|
#ifndef CLOCK_MONOTONIC
|
||||||
|
@ -306,8 +306,10 @@ static int in_uint16_table(unsigned ucs, const uint16_t *table, unsigned max)
|
|||||||
unsigned first, last;
|
unsigned first, last;
|
||||||
|
|
||||||
first = table[0] >> 2;
|
first = table[0] >> 2;
|
||||||
last = first + (table[0] & 3);
|
if (ucs < first)
|
||||||
if (ucs < first || ucs > last)
|
return 0;
|
||||||
|
last = (table[max] >> 2) + (table[max] & 3);
|
||||||
|
if (ucs > last)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
min = 0;
|
min = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user