hangul_combination_combine() 함수의 비교함수에서 두 key 값을 단순히
뺄셈연산하여 리턴하게 되면 두수의 크기차 signed int를 넘어서는 경우에
음수로 연산될 수 있어서 위험하다. 부등호를 이용하여 비교연산으로 처리한다.
Unicode 5.2에서 추가된 자모들중 U+A960, U+D7B0 영역의 문자들을 조합하지
못하는 문제 수정
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@241
8f00fcd2-89fc-0310-932e-
b01be5b65e01
{
const HangulCombinationItem *item1 = p1;
const HangulCombinationItem *item2 = p2;
- return item1->key - item2->key;
+
+ /* key는 unsigned int이므로 단순히 빼서 리턴하면 안된다.
+ * 두 수의 차가 큰 경우 int로 변환하면서 음수가 될 수 있다. */
+ if (item1->key < item2->key)
+ return -1;
+ else if (item1->key > item2->key)
+ return 1;
+ else
+ return 0;
}
ucschar