[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-6' - external/hunspell lingucomponent/source

László Németh nemeth at numbertext.org
Wed Jul 23 08:40:17 PDT 2014


 external/hunspell/hunspell-fdo48017-wfopen.patch     |    9 +++++++--
 lingucomponent/source/lingutil/lingutil.cxx          |    8 ++++++++
 lingucomponent/source/lingutil/lingutil.hxx          |    5 +++++
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |    4 ++--
 4 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 93350f3d968e01057cf0075582edbfa9a847ed1d
Author: László Németh <nemeth at numbertext.org>
Date:   Tue Jul 22 20:06:24 2014 +0200

    fdo#80363 backport of the fix for Cyrillic spell. dictionary path
    
    (cherry picked from commit e77a9785ca76d7350bbcbe8a107a80f89bc72831)
    
    Change-Id: I1b9c016e8d04f1cf14dad2a421c7eeb513a7b2ff
    Reviewed-on: https://gerrit.libreoffice.org/10472
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/external/hunspell/hunspell-fdo48017-wfopen.patch b/external/hunspell/hunspell-fdo48017-wfopen.patch
index 47b803b..37203be 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 c0ef851..ab2244b 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 f5f1d76..5319661 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 1809efe..cf3d26f 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()));


More information about the Libreoffice-commits mailing list