KAKASI 2.3.5pre1 をコンパイルして気になったところを修正してみました。
- iconv_t 変数にキャストなしで -1 を代入または比較している部分を修正
- ptype 変数を初期化せずに使用しているため、未定義の値を参照する可能性があったのを修正
- 関数のプロトタイプ宣言なしで pututf8 を使っていたので、関数のプロトタイプを追加
- make dist の際に tests/env.sh が tarball に含まれないバグを修正
--- src/kakasi.c.org 2007-09-19 17:55:33.000000000 +0900
+++ src/kakasi.c 2007-09-19 17:55:28.000000000 +0900
@@ -53,8 +53,8 @@
#ifdef KAKASI_SUPPORT_UTF8
#include
-iconv_t fromutf8 = -1;
-iconv_t toutf8 = -1;
+iconv_t fromutf8 = (iconv_t)-1;
+iconv_t toutf8 = (iconv_t)-1;
#endif /* KAKASI_SUPPORT_UTF8 */
/* FIXME: this macro should be removed future. */
@@ -638,7 +638,7 @@
setcharbuffer((unsigned char *)str);
#endif
- pctype = OTHER;
+ ptype = pctype = OTHER;
separator_out = 0;
for(;;) {
getkanji(c);
--- src/kanjiio.c.org 2007-09-19 17:55:33.000000000 +0900
+++ src/kanjiio.c 2007-09-19 17:55:28.000000000 +0900
@@ -90,6 +90,7 @@
else \
Len = -1;
+void pututf8(int f, int s);
#endif /* KAKASI_SUPPORT_UTF8 */
@@ -552,7 +553,7 @@
utf8[i] = getchar();
}
fromlen = len;
- if (fromutf8 == -1)
+ if (fromutf8 == (iconv_t)-1)
fromutf8 = iconv_open("EUC-JP", "UTF-8");
l = iconv(fromutf8, &from, &fromlen, &to, &tolen);
if (tolen == 1) {
@@ -1063,7 +1064,7 @@
int i;
fromstr[0] = (char) f;
fromstr[1] = (char) s;
- if (toutf8 == -1)
+ if (toutf8 == (iconv_t)-1)
toutf8 = iconv_open("UTF-8", "EUC-JP");
l = iconv(toutf8, &from, &fromlen, &to, &tolen);
if (tolen >= 6 || tolen < 0)
--- tests/Makefile.am.org 2007-09-19 18:03:34.000000000 +0900
+++ tests/Makefile.am 2007-09-19 17:54:07.000000000 +0900
@@ -9,4 +9,4 @@
clean-local:
rm -f test-log tmp
-EXTRA_DIST = $(TESTS)
+EXTRA_DIST = $(TESTS) env.sh
セコメントをする