summaryrefslogtreecommitdiffstats
path: root/external/hyphen/hyphen-fdo48017-wfopen.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/hyphen/hyphen-fdo48017-wfopen.patch
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/hyphen/hyphen-fdo48017-wfopen.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/external/hyphen/hyphen-fdo48017-wfopen.patch b/external/hyphen/hyphen-fdo48017-wfopen.patch
new file mode 100644
index 000000000..815eeda79
--- /dev/null
+++ b/external/hyphen/hyphen-fdo48017-wfopen.patch
@@ -0,0 +1,49 @@
+diff -u hyphen/hyphen.c build/hyphen/hyphen.c
+--- hyphen/hyphen.c 2014-05-22 00:28:13.164587974 +0200
++++ build/hyphen/hyphen.c 2015-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,12 +376,32 @@
+ }
+ }
+
++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));
++ wchar_t *buff2 = (wchar_t *) malloc(len * sizeof(wchar_t));
++ FILE * f = NULL;
++ MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
++ if (_wfullpath( buff2, buff, len ) != NULL) {
++ f = _wfopen(buff2, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
++ }
++ free(buff);
++ free(buff2);
++ return f;
++ }
++#endif
++ return fopen(path, mode);
++}
++
+ HyphenDict *
+ hnj_hyphen_load (const char *fn)
+ {
+ HyphenDict *result;
+ FILE *f;
+- f = fopen (fn, "r");
++ f = hnj_fopen (fn, "r");
+ if (f == NULL)
+ return NULL;
+