summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--external/hunspell/hunspell-fdo48017-wfopen.patch9
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx8
-rw-r--r--lingucomponent/source/lingutil/lingutil.hxx5
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx4
4 files changed, 22 insertions, 4 deletions
diff --git a/external/hunspell/hunspell-fdo48017-wfopen.patch b/external/hunspell/hunspell-fdo48017-wfopen.patch
index 47b803bc6529..37203be5c3f9 100644
--- a/external/hunspell/hunspell-fdo48017-wfopen.patch
+++ b/external/hunspell/hunspell-fdo48017-wfopen.patch
@@ -13,7 +13,7 @@ diff -ru hunspell/src/hunspell/csutil.cxx build/hunspell/src/hunspell/csutil.cxx
#ifdef OPENOFFICEORG
# include <unicode/uchar.h>
#else
-@@ -46,6 +50,21 @@
+@@ -51,6 +51,26 @@
static struct unicode_info2 * utf_tbl = NULL;
static int utf_tbl_count = 0; // utf_tbl can be used by multiple Hunspell instances
@@ -23,9 +23,14 @@ diff -ru hunspell/src/hunspell/csutil.cxx build/hunspell/src/hunspell/csutil.cxx
+ 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);
-+ FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
++ if (_wfullpath( buff2, buff, len ) != NULL) {
++ f = _wfopen(buff2, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
++ }
+ free(buff);
++ free(buff2);
+ return f;
+ }
+#endif
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index c0ef851f46a2..ab2244ba8ef7 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -48,6 +48,14 @@ using ::com::sun::star::lang::Locale;
using namespace ::com::sun::star;
#if defined(WNT)
+
+OString Win_AddLongPathPrefix( const OString &rPathName )
+{
+#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
+ if (!rPathName.match(WIN32_LONG_PATH_PREFIX)) return WIN32_LONG_PATH_PREFIX + rPathName;
+ return rPathName;
+}
+
OString Win_GetShortPathName( const OUString &rLongPathName )
{
OString aRes;
diff --git a/lingucomponent/source/lingutil/lingutil.hxx b/lingucomponent/source/lingutil/lingutil.hxx
index f5f1d76356c8..5319661399c5 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -54,6 +54,11 @@ inline sal_Bool operator == ( const ::com::sun::star::lang::Locale &rL1, const :
}
#if defined(WNT)
+
+// to be use to get a path name with long path prefix
+// under Windows for Hunspell
+OString Win_AddLongPathPrefix( const OString &rPathName );
+
///////////////////////////////////////////////////////////////////////////
// to be use to get a short path name under Windows that still can be used with
// the 'fopen' call. This is necessary since under Windows there seems to be
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 1809efe96b95..cf3d26f7afa7 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -315,8 +315,8 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rL
// about 120+ characters which will usually be exceed when
// using dictionaries as extensions. (Hunspell waits UTF-8 encoded
// path with \\?\ long path prefix.)
- OString aTmpaff = OUStringToOString(aff, RTL_TEXTENCODING_UTF8);
- OString aTmpdict = OUStringToOString(dict, RTL_TEXTENCODING_UTF8);
+ OString aTmpaff = Win_AddLongPathPrefix(OUStringToOString(aff, RTL_TEXTENCODING_UTF8));
+ OString aTmpdict = Win_AddLongPathPrefix(OUStringToOString(dict, RTL_TEXTENCODING_UTF8));
#else
OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));