diff options
author | Won-Kyu Park <wkpark@gmail.com> | 2023-02-11 13:23:51 +0900 |
---|---|---|
committer | Won-Kyu Park <wkpark@gmail.com> | 2023-02-12 00:40:57 +0900 |
commit | 2eee4916eede1eff6fbe6bf33d150c0e28551593 (patch) | |
tree | 7436eea93fe529fa8abc2fd70be97f3f105613d8 | |
parent | a3d8eb6167cb92fe9d192402bb9b8dbe20ff7e26 (diff) | |
download | libhangul-2eee4916eede1eff6fbe6bf33d150c0e28551593.tar.gz |
WIN32 build fixes
-rw-r--r-- | hangul/hangulinputcontext.c | 4 | ||||
-rw-r--r-- | hangul/hangulkeyboard.c | 6 | ||||
-rw-r--r-- | hangul/hanja.c | 5 | ||||
-rw-r--r-- | test/hangul.c | 2 | ||||
-rw-r--r-- | test/test.c | 7 |
5 files changed, 22 insertions, 2 deletions
diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c index cd54945..ee43f5e 100644 --- a/hangul/hangulinputcontext.c +++ b/hangul/hangulinputcontext.c @@ -21,7 +21,11 @@ #include <stdlib.h> #include <string.h> +#ifndef _WIN32 #include <strings.h> +#else +#define strcasecmp _stricmp +#endif #include <ctype.h> #include <inttypes.h> #include <limits.h> diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c index 11354d8..9e1e599 100644 --- a/hangul/hangulkeyboard.c +++ b/hangul/hangulkeyboard.c @@ -35,6 +35,10 @@ #include "hangul.h" #include "hangulinternals.h" +#ifdef _WIN32 +#define strdup _strdup +#endif + /** * @file hangulkeyboard.c */ @@ -831,6 +835,7 @@ hangul_keyboard_list_clear() hangul_keyboards.keyboards = NULL; } +#if ENABLE_EXTERNAL_KEYBOARDS static char* hangul_keyboard_get_default_keyboard_path() { @@ -886,6 +891,7 @@ hangul_keyboard_get_keyboard_path() return keyboard_path; } +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ int hangul_keyboard_list_init() diff --git a/hangul/hanja.c b/hangul/hanja.c index 0cbe347..0bed47f 100644 --- a/hangul/hanja.c +++ b/hangul/hanja.c @@ -22,7 +22,12 @@ #include <sys/types.h> #include <sys/stat.h> +#ifndef _WIN32 #include <unistd.h> +#else +#include <io.h> +#define strtok_r strtok_s +#endif #ifdef HAVE_MMAP #include <sys/mman.h> diff --git a/test/hangul.c b/test/hangul.c index a019f06..b00bd6a 100644 --- a/test/hangul.c +++ b/test/hangul.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) char* keyboard_path = getenv("LIBHANGUL_KEYBOARD_PATH"); if (keyboard_path == NULL) - setenv("LIBHANGUL_KEYBOARD_PATH", TEST_LIBHANGUL_KEYBOARD_PATH, 1); + putenv("LIBHANGUL_KEYBOARD_PATH=" TEST_LIBHANGUL_KEYBOARD_PATH); hangul_init(); diff --git a/test/test.c b/test/test.c index f476c48..1ee83a3 100644 --- a/test/test.c +++ b/test/test.c @@ -1,5 +1,6 @@ #include <stdarg.h> #include <stdlib.h> +#include <stdio.h> #include <wchar.h> #include <check.h> @@ -528,6 +529,7 @@ START_TEST(test_syllable_iterator) } END_TEST +#if ENABLE_EXTERNAL_KEYBOARDS START_TEST(test_hangul_keyboard) { const char* id; @@ -575,6 +577,7 @@ START_TEST(test_hangul_keyboard) hangul_keyboard_delete(keyboard); } END_TEST +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ START_TEST(test_hangul_jamo_to_cjamo) { @@ -604,7 +607,9 @@ Suite* libhangul_suite() tcase_add_test(hangul, test_hangul_ic_combi_on_double_stroke); tcase_add_test(hangul, test_hangul_ic_non_choseong_combi); tcase_add_test(hangul, test_syllable_iterator); +#if ENABLE_EXTERNAL_KEYBOARDS tcase_add_test(hangul, test_hangul_keyboard); +#endif /* ENABLE_EXTERNAL_KEYBOARDS */ tcase_add_test(hangul, test_hangul_jamo_to_cjamo); suite_add_tcase(s, hangul); @@ -615,7 +620,7 @@ int main() { char* keyboard_path = getenv("LIBHANGUL_KEYBOARD_PATH"); if (keyboard_path == NULL) - setenv("LIBHANGUL_KEYBOARD_PATH", TEST_LIBHANGUL_KEYBOARD_PATH, 1); + putenv("LIBHANGUL_KEYBOARD_PATH=" TEST_LIBHANGUL_KEYBOARD_PATH); hangul_init(); |