summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2008-05-03 17:09:13 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2008-05-03 17:09:13 +0900
commit31beaab347a0054776bb497f8d5bc5c437465e90 (patch)
tree2a94a3a3512879a494c31fffde613aa0609a4fa6
parent7d4686cd9b8faf15a525b84aad0441d0318c5b30 (diff)
downloadlibhangul-31beaab347a0054776bb497f8d5bc5c437465e90.tar.gz
hangul_syllable_len(), hangul_jamos_to_syllables()에서
마지막 글자가 0으로 끝나지 않을 경우 제대로 변환되지 않는 문제 수정 git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@181 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r--hangul/hangulctype.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hangul/hangulctype.c b/hangul/hangulctype.c
index 173f76b..ee0be2f 100644
--- a/hangul/hangulctype.c
+++ b/hangul/hangulctype.c
@@ -593,6 +593,9 @@ hangul_syllable_len(const ucschar* str, int max_len)
{
int i = 0;
+ if (max_len == 0)
+ return 0;
+
if (str[i] != 0) {
for (i = 1; i < max_len; i++) {
if (str[i] == 0)
@@ -653,7 +656,7 @@ hangul_jamos_to_syllables(ucschar* dest, int destlen, const ucschar* src, int sr
outleft = destlen;
n = hangul_syllable_len(s, inleft);
- while (n > 0 && outleft > 0) {
+ while (n > 0 && inleft > 0 && outleft > 0) {
ucschar c = build_syllable(s, n);
if (c != 0) {
*d = c;