/* Access functions for KS C 5601-1992 based encoding conversion.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
static inline uint32_t
ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
{
- unsigned char ch = *(*s);
+ unsigned char ch = **s;
unsigned char ch2;
int idx;
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) >= 0x7e
|| (ch - offset) == 0x49)
- return UNKNOWN_10646_CHAR;
+ return __UNKNOWN_10646_CHAR;
if (avail < 2)
return 0;
ch2 = (*s)[1];
if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
- return UNKNOWN_10646_CHAR;
+ return __UNKNOWN_10646_CHAR;
idx = (ch - offset - 0x21) * 94 + (ch2 - offset - 0x21);
/* 1410 = 15 * 94 , 3760 = 40 * 94
Hangul in KS C 5601 : row 16 - row 40 */
- (*s) += 2;
+ *s += 2;
- if (idx >= 1410 && idx < 3760)
+ if (idx >= 1410 && idx < 1410 + KSC5601_HANGUL)
return (__ksc5601_hangul_to_ucs[idx - 1410]
- ?: ((*s) -= 2, UNKNOWN_10646_CHAR));
+ ?: ((*s) -= 2, __UNKNOWN_10646_CHAR));
else if (idx >= 3854)
/* Hanja : row 42 - row 93 : 3854 = 94 * (42-1) */
return (__ksc5601_hanja_to_ucs[idx - 3854]
- ?: ((*s) -= 2, UNKNOWN_10646_CHAR));
- else
- return __ksc5601_sym_to_ucs[idx] ?: ((*s) -= 2, UNKNOWN_10646_CHAR);
+ ?: ((*s) -= 2, __UNKNOWN_10646_CHAR));
+ else if (idx <= 1114)
+ return __ksc5601_sym_to_ucs[idx] ?: ((*s) -= 2, __UNKNOWN_10646_CHAR);
+
+ return __UNKNOWN_10646_CHAR;
}
static inline size_t
}
}
- return UNKNOWN_10646_CHAR;
+ return __UNKNOWN_10646_CHAR;
}
}
}
- return UNKNOWN_10646_CHAR;
+ return __UNKNOWN_10646_CHAR;
}
static inline size_t
}
}
- return UNKNOWN_10646_CHAR;
+ return __UNKNOWN_10646_CHAR;
}