hangul_syllable_len(), hangul_jamos_to_syllables()에서
authorChoe Hwanjin <choe.hwanjin@gmail.com>
Sat, 3 May 2008 08:09:13 +0000 (17:09 +0900)
committerChoe Hwanjin <choe.hwanjin@gmail.com>
Sat, 3 May 2008 08:09:13 +0000 (17:09 +0900)
마지막 글자가 0으로 끝나지 않을 경우 제대로 변환되지 않는 문제 수정

git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@181 8f00fcd2-89fc-0310-932e-b01be5b65e01

hangul/hangulctype.c

index 173f76b..ee0be2f 100644 (file)
@@ -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;