[Libreoffice-commits] core.git: include/sal lingucomponent/source

Stephan Bergmann sbergman at redhat.com
Tue Feb 2 11:40:39 UTC 2016


 include/sal/log-areas.dox                            |    1 
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   21 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 3c51c3db186e243a7e96103242285b2854725a18
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 2 11:54:32 2016 +0100

    Attempted fix for "Resolves: #i126762# Ignore dictionary not in specified...
    
    ...location."  Caused many crashed during "make check", when aLocaleNames is a
    sequence of 17 ("ar-SA", "ar-DZ", ...), but aLcoations merely a sequence of 2
    (".../dict-ar/ar.aff", ".../dict-ar/ar.dic").
    
    From comments further down below, it looks like aLocations will always contain
    exactly two entries ("also both files have to be in the same directory and the
    file names must only differ in the extension (.aff/.dic)"), and that all the
    aLocaleNames members share the same set of aLocations ("Thus here we work-around
    this by adding the same dictionary several times. Once for each of its supported
    locales"), so that it would appear to be OK to just check once for the existenceof aLocations[0].
    
    (There is a check for
    
        if (aDictIt->aLocaleNames.getLength() > 0 &&
            aDictIt->aLocations.getLength() > 0)
    
    below, so it might be that these can be empty, or it might just be "defensive
    programming."  Play it safe, and check here that aLocations is not empty.)
    
    Change-Id: I82bea6571983e397a9e164b294a5ba656b511a67

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 99fdfd5..d6251fc 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -526,6 +526,7 @@ certain functionality.
 @li @c drawinglayer
 @li @c helpcompiler
 @li @c jvmaccess
+ at li @c lingucomponent
 @li @c linguistic
 @li @c lwp - lotuswordpro
 @li @c mysqlc
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index e8ec4e8..51166e6 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -43,6 +43,7 @@
 #include <osl/file.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/textenc.h>
+#include <sal/log.hxx>
 
 #include <list>
 #include <set>
@@ -153,12 +154,24 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
             {
                 uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames );
                 uno::Sequence< OUString > aLocations( aDictIt->aLocations );
-                sal_Int32 nLen2 = aLocaleNames.getLength();
-                for (k = 0;  k < nLen2;  ++k)
+                SAL_WARN_IF(
+                    aLocaleNames.hasElements() && !aLocations.hasElements(),
+                    "lingucomponent", "no locations");
+                if (aLocations.hasElements())
                 {
-                    if (xAccess.is() && xAccess->exists(aLocations[k]))
+                    if (xAccess.is() && xAccess->exists(aLocations[0]))
                     {
-                        aLocaleNamesSet.insert( aLocaleNames[k] );
+                        sal_Int32 nLen2 = aLocaleNames.getLength();
+                        for (k = 0;  k < nLen2;  ++k)
+                        {
+                            aLocaleNamesSet.insert( aLocaleNames[k] );
+                        }
+                    }
+                    else
+                    {
+                        SAL_WARN(
+                            "lingucomponent",
+                            "missing <" << aLocations[0] << ">");
                     }
                 }
             }


More information about the Libreoffice-commits mailing list