summaryrefslogtreecommitdiff
path: root/external/hyphen
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2014-05-22 12:27:44 +0200
committerLászló Németh <nemeth@numbertext.org>2014-05-23 01:06:50 +0200
commit6d06aa8ba83b7629603cd86cf14a63c432ce268f (patch)
treeb5dee722f6f43f1acb20af35534b37d20df8fee7 /external/hyphen
parent7818974103fcdf16e03354f62a4165eedea4427c (diff)
fdo#48017 WIN32 long path support in Hyphen and MyThes
Change-Id: Ifb068efb553ed24a7caf65dbab28726bdeced0e6
Diffstat (limited to 'external/hyphen')
-rw-r--r--external/hyphen/UnpackedTarball_hyphen.mk1
-rw-r--r--external/hyphen/hyphen-fdo48017-wfopen.patch46
2 files changed, 47 insertions, 0 deletions
diff --git a/external/hyphen/UnpackedTarball_hyphen.mk b/external/hyphen/UnpackedTarball_hyphen.mk
index 5cd0af80bd22..c112b3597338 100644
--- a/external/hyphen/UnpackedTarball_hyphen.mk
+++ b/external/hyphen/UnpackedTarball_hyphen.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,hyphen,\
external/hyphen/hyphen-android.patch \
external/hyphen/hyphen-rhmin.patch \
external/hyphen/hyphen-build.patch \
+ external/hyphen/hyphen-fdo48017-wfopen.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/hyphen/hyphen-fdo48017-wfopen.patch b/external/hyphen/hyphen-fdo48017-wfopen.patch
new file mode 100644
index 000000000000..9a73b4a75025
--- /dev/null
+++ b/external/hyphen/hyphen-fdo48017-wfopen.patch
@@ -0,0 +1,46 @@
+diff -u hyphen/hyphen.c build/hyphen/hyphen.c
+--- hyphen/hyphen.c 2014-05-22 00:28:13.164587974 +0200
++++ build/hyphen/hyphen.c 2014-05-22 11:08:55.000000000 +0200
+@@ -44,6 +44,11 @@
+ #include <unistd.h> /* for exit */
+ #endif
+
++#ifdef _WIN32
++#include <windows.h>
++#include <wchar.h>
++#endif
++
+ #define noVERBOSE
+
+ /* calculate hyphenmin values with long ligature length (2 or 3 characters
+@@ -371,6 +376,21 @@
+ }
+ }
+
++FILE * hnj_fopen(const char * path, const char * mode) {
++#ifdef _WIN32
++#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
++ if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
++ int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
++ wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
++ MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
++ FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
++ free(buff);
++ return f;
++ }
++#endif
++ return fopen(path, mode);
++}
++
+ HyphenDict *
+ hnj_hyphen_load (const char *fn)
+ {
+@@ -383,7 +403,7 @@
+ HashEntry *e;
+ int state_num = 0;
+
+- f = fopen (fn, "r");
++ f = hnj_fopen (fn, "r");
+ if (f == NULL)
+ return NULL;
+