Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please find attached a partial fix for Easy Hack FDO43460

Part XXIII
Modules
linguistic
- -- 
Olivier Hallot
Founder, Board of Directors Member - The Document Foundation
LibreOffice translation leader for Brazilian Portuguese
+55-21-8822-8812
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO+cP/AAoJEJp3R7nH3vLxgz4H/2TaRPGZgVGlteYX4RoVVtp8
7uTTLiycJOipEQU4eLPAxLSCiKWBBzw/eQITO31CwRlgXM8FxxDHjQlx1reE/2Cc
c9kqzbnnD2gxxUlHnk6rCZKjFn/E3aQKEA1VUMuDZsWmMjPjtSnj1dsplHm0TJ+W
TjKlTwJ69sLhk7Doxo6RmfXgjBQGOnB5i1bT4ehTyWch9qg3TlCzskHEJL0n/Ide
RU6kevnVJQf9ibmXtMTrTnR4GQwQmHRuMwMpURG0t/mesgUmFwzEth/Fb5ufBIuD
3yEMWXwcysPvzyYtvnospNyVXQuT4xeBk4bh33FH5SN9cngI6PhRll+YkuYUwUU=
=Ahyj
-----END PGP SIGNATURE-----
From dc7965dcd5c0a062cd1d3caada0154a16970a5fb Mon Sep 17 00:00:00 2001
From: Olivier Hallot <olivier.hallot@alta.org.br>
Date: Tue, 27 Dec 2011 11:08:04 -0200
Subject: [PATCH] Fix for fdo43460 Part XXIII getLength() to isEmpty()

Part XXIII
Modules
linguistic
---
 linguistic/source/dicimp.cxx      |   10 +++++-----
 linguistic/source/dlistimp.cxx    |    2 +-
 linguistic/source/gciterator.cxx  |    8 ++++----
 linguistic/source/hyphdsp.cxx     |    2 +-
 linguistic/source/lngprophelp.cxx |    4 ++--
 linguistic/source/lngsvcmgr.cxx   |   24 ++++++++++++------------
 linguistic/source/misc.cxx        |    4 ++--
 linguistic/source/misc2.cxx       |    6 +++---
 linguistic/source/spelldsp.cxx    |   12 ++++++------
 linguistic/source/spelldta.cxx    |    2 +-
 linguistic/source/thesdsp.cxx     |    2 +-
 11 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 1af7d36..0a09ad5 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -230,7 +230,7 @@ DictionaryNeo::DictionaryNeo(const OUString &rName,
     bIsModified  = bIsActive = sal_False;
     bIsReadonly = !bWriteable;
 
-    if( rMainURL.getLength() > 0 )
+    if( !rMainURL.isEmpty())
     {
         sal_Bool bExists = FileExists( rMainURL );
         if( !bExists )
@@ -271,7 +271,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
     // function should only be called once in order to load entries from file
     bNeedEntries = sal_False;
 
-    if (rMainURL.getLength() == 0)
+    if (rMainURL.isEmpty())
         return 0;
 
     uno::Reference< lang::XMultiServiceFactory > xServiceFactory( 
comphelper::getProcessServiceFactory() );
@@ -411,7 +411,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
 {
     MutexGuard  aGuard( GetLinguMutex() );
 
-    if (rURL.getLength() == 0)
+    if (rURL.isEmpty())
         return 0;
     DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
 
@@ -999,7 +999,7 @@ sal_Bool SAL_CALL DictionaryNeo::hasLocation()
         throw(RuntimeException)
 {
     MutexGuard  aGuard( GetLinguMutex() );
-    return aMainURL.getLength() > 0;
+    return !aMainURL.isEmpty();
 }
 
 OUString SAL_CALL DictionaryNeo::getLocation()
@@ -1075,7 +1075,7 @@ void SAL_CALL DictionaryNeo::storeToURL(
 DicEntry::DicEntry(const OUString &rDicFileWord,
                    sal_Bool bIsNegativWord)
 {
-    if (rDicFileWord.getLength())
+    if (!rDicFileWord.isEmpty())
         splitDicFileWord( rDicFileWord, aDicWord, aReplacement );
     bIsNegativ = bIsNegativWord;
 }
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index ac4f143..e824888 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -698,7 +698,7 @@ void DicList::_CreateDicList()
     sal_Int32 nLen = aActiveDics.getLength();
     for (sal_Int32 i = 0;  i < nLen;  ++i)
     {
-        if (pActiveDic[i].getLength())
+        if (!pActiveDic[i].isEmpty())
         {
             uno::Reference< XDictionary > xDic( getDictionaryByName( pActiveDic[i] ) );
             if (xDic.is())
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 1f6ef14..bdd6ee3 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -552,7 +552,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
 
                     sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
                     sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, 
aCurLocale );
-                    DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.getLength() == 0) || nSuggestedEnd 
nStartPos,
+                    DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.isEmpty()) || nSuggestedEnd > 
nStartPos,
                             "nSuggestedEndOfSentencePos calculation failed?" );
 
                     linguistic2::ProofreadingResult aRes;
@@ -824,7 +824,7 @@ throw (uno::RuntimeException)
         {
             // check in document is checked automatically in the background...
             OUString aDocId = aIt->second;
-            if (m_aCurCheckedDocId.getLength() > 0 && m_aCurCheckedDocId == aDocId)
+            if (!m_aCurCheckedDocId.isEmpty() && m_aCurCheckedDocId == aDocId)
             {
                 // an entry for that document was dequed and is currently being checked.
                 bRes = sal_True;
@@ -1099,7 +1099,7 @@ void GrammarCheckingIterator::SetServiceList(
 
     if (nLanguage != LANGUAGE_NONE && nLanguage != LANGUAGE_DONTKNOW)
     {
-        if (aImplName.getLength() > 0)
+        if (!aImplName.isEmpty())
             m_aGCImplNamesByLang[ nLanguage ] = aImplName;
         else
             m_aGCImplNamesByLang.erase( nLanguage );
@@ -1120,7 +1120,7 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
     if (aIt != m_aGCImplNamesByLang.end())
         aImplName = aIt->second;
 
-    if (aImplName.getLength() > 0)
+    if (!aImplName.isEmpty())
         aRes[0] = aImplName;
     else
         aRes.realloc(0);
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 796e24c..adaf3f3 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -541,7 +541,7 @@ Reference< XPossibleHyphens > SAL_CALL
     Reference< XPossibleHyphens >   xRes;
 
     sal_Int16 nLanguage = LocaleToLanguage( rLocale );
-    if (nLanguage == LANGUAGE_NONE  || !rWord.getLength())
+    if (nLanguage == LANGUAGE_NONE  || rWord.isEmpty())
         return xRes;
 
     // search for entry with that language
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index da7c08d..91571f5 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -262,7 +262,7 @@ void PropertyChgHelper::AddAsPropListener()
         const OUString *pPropName = aPropNames.getConstArray();
         for (sal_Int32 i = 0;  i < nLen;  ++i)
         {
-            if (pPropName[i].getLength())
+            if (!pPropName[i].isEmpty())
                 xPropSet->addPropertyChangeListener( pPropName[i], this );
         }
     }
@@ -276,7 +276,7 @@ void PropertyChgHelper::RemoveAsPropListener()
         const OUString *pPropName = aPropNames.getConstArray();
         for (sal_Int32 i = 0;  i < nLen;  ++i)
         {
-            if (pPropName[i].getLength())
+            if (!pPropName[i].isEmpty())
                 xPropSet->removePropertyChangeListener( pPropName[i], this );
         }
     }
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 6744739..00acac2 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -67,7 +67,7 @@ static sal_Bool lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const O
     sal_Bool bRes = sal_False;
 
     sal_Int32 nLen = rSeq.getLength();
-    if (nLen == 0 || rText.getLength() == 0)
+    if (nLen == 0 || rText.isEmpty())
         return bRes;
 
     const OUString *pSeq = rSeq.getConstArray();
@@ -528,7 +528,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
         OUString aKeyText;
         if (nKeyStart != -1)
             aKeyText = rName.copy( nKeyStart + 1 );
-        DBG_ASSERT( aKeyText.getLength() != 0, "unexpected key (lang::Locale) string" );
+        DBG_ASSERT( !aKeyText.isEmpty(), "unexpected key (lang::Locale) string" );
         if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() ))
         {
             // delete old cached data, needs to be acquired new on demand
@@ -547,7 +547,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                     aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
 
                 LanguageType nLang = LANGUAGE_NONE;
-                if (0 != aKeyText.getLength())
+                if (!aKeyText.isEmpty())
                     nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
 
                 GetSpellCheckerDsp_Impl( sal_False );     // don't set service list, it will be 
done below
@@ -572,7 +572,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                     aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
 
                 LanguageType nLang = LANGUAGE_NONE;
-                if (0 != aKeyText.getLength())
+                if (!aKeyText.isEmpty())
                     nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
 
                 if (SvtLinguConfig().HasGrammarChecker())
@@ -600,7 +600,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                     aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
 
                 LanguageType nLang = LANGUAGE_NONE;
-                if (0 != aKeyText.getLength())
+                if (!aKeyText.isEmpty())
                     nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
 
                 GetHyphenatorDsp_Impl( sal_False );   // don't set service list, it will be done 
below
@@ -625,7 +625,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                     aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
 
                 LanguageType nLang = LANGUAGE_NONE;
-                if (0 != aKeyText.getLength())
+                if (!aKeyText.isEmpty())
                     nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
 
                 GetThesaurusDsp_Impl( sal_False );  // don't set service list, it will be done 
below
@@ -772,7 +772,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
                         uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
                         if (xInfo.is())
                             aImplName = xInfo->getImplementationName();
-                        DBG_ASSERT( aImplName.getLength(),
+                        DBG_ASSERT( !aImplName.isEmpty(),
                                 "empty implementation name" );
                         uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, 
uno::UNO_QUERY );
                         DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
@@ -837,7 +837,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
                         uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
                         if (xInfo.is())
                             aImplName = xInfo->getImplementationName();
-                        DBG_ASSERT( aImplName.getLength(),
+                        DBG_ASSERT( !aImplName.isEmpty(),
                                 "empty implementation name" );
                         uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, 
uno::UNO_QUERY );
                         DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
@@ -901,7 +901,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
                         uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
                         if (xInfo.is())
                             aImplName = xInfo->getImplementationName();
-                        DBG_ASSERT( aImplName.getLength(),
+                        DBG_ASSERT( !aImplName.isEmpty(),
                                 "empty implementation name" );
                         uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, 
uno::UNO_QUERY );
                         DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
@@ -967,7 +967,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
                         uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
                         if (xInfo.is())
                             aImplName = xInfo->getImplementationName();
-                        DBG_ASSERT( aImplName.getLength(),
+                        DBG_ASSERT( !aImplName.isEmpty(),
                                 "empty implementation name" );
                         uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, 
uno::UNO_QUERY );
                         DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
@@ -1570,7 +1570,7 @@ static uno::Sequence< OUString > GetLangSvcList( const uno::Any &rVal )
             for (sal_Int32 j = 0;  j < nSvcs;  ++j)
             {
                 OUString aImplName( pSvcName[j] );
-                DBG_ASSERT( aImplName.getLength(), "service impl-name missing" );
+                DBG_ASSERT( !aImplName.isEmpty(), "service impl-name missing" );
             }
         }
 #endif
@@ -1599,7 +1599,7 @@ static uno::Sequence< OUString > GetLangSvc( const uno::Any &rVal )
     else
     {
         OUString aImplName;
-        if ((rVal >>= aImplName) && aImplName.getLength() != 0)
+        if ((rVal >>= aImplName) && !aImplName.isEmpty())
         {
             aRes.realloc(1);
             aRes.getArray()[0] = aImplName;
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index e380300..3e10cf3 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -381,7 +381,7 @@ sal_uInt8 AddEntryToDic(
 LanguageType LocaleToLanguage( const Locale& rLocale )
 {
     //  empty Locale -> LANGUAGE_NONE
-    if ( rLocale.Language.getLength() == 0 )
+    if ( rLocale.Language.isEmpty() )
         return LANGUAGE_NONE;
 
     return MsLangId::convertLocaleToLanguage( rLocale );
@@ -546,7 +546,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
         uno::Reference< XHyphenatedWord > &rxHyphWord )
 {
     uno::Reference< XHyphenatedWord > xRes;
-    if (rOrigWord.getLength() && rxHyphWord.is())
+    if (!rOrigWord.isEmpty() && rxHyphWord.is())
     {
         sal_Int16    nChgPos = 0,
                  nChgLen = 0;
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index 167a116..8ca3cc0 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -109,12 +109,12 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
         // 2. all user pathes
         // 3. all internal pathes
         sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
-        if (aWritablePath.getLength() > 0)
+        if (!aWritablePath.isEmpty())
             ++nMaxEntries;
         aRes.realloc( nMaxEntries );
         rtl::OUString *pRes = aRes.getArray();
         sal_Int32 nCount = 0;   // number of actually added entries
-        if ((nPathFlags & PATH_FLAG_WRITABLE) && aWritablePath.getLength() != 0)
+        if ((nPathFlags & PATH_FLAG_WRITABLE) && !aWritablePath.isEmpty())
             pRes[ nCount++ ] = aWritablePath;
         for (int i = 0;  i < 2;  ++i)
         {
@@ -124,7 +124,7 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
             {
                 const bool bAddUser     = &rPathSeq == &aUserPaths     && (nPathFlags & 
PATH_FLAG_USER);
                 const bool bAddInternal = &rPathSeq == &aInternalPaths && (nPathFlags & 
PATH_FLAG_INTERNAL);
-                if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
+                if ((bAddUser || bAddInternal) && !pPathSeq[k].isEmpty())
                     pRes[ nCount++ ] = pPathSeq[k];
             }
         }
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 7b25318..f232f1c 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -141,7 +141,7 @@ size_t ProposalList::Count() const
     size_t nLen = aVec.size();
     for (size_t i = 0;  i < nLen;  ++i)
     {
-        if (aVec[i].getLength() != 0)
+        if (!aVec[i].isEmpty())
             ++nRes;
     }
     return nRes;
@@ -158,7 +158,7 @@ Sequence< OUString > ProposalList::GetSequence() const
     {
         const OUString &rText = aVec[i];
         DBG_ASSERT( nIdx < nCount, "index our of range" );
-        if (nIdx < nCount && rText.getLength() > 0)
+        if (nIdx < nCount && !rText.isEmpty())
             pRes[ nIdx++ ] = rText;
     }
     return aRes;
@@ -191,7 +191,7 @@ sal_Bool SvcListHasLanguage(
     {
         if (pRef[k].is())
         {
-            if (0 == aTmpLocale.Language.getLength())
+            if (aTmpLocale.Language.isEmpty())
                 aTmpLocale = CreateLocale( nLanguage );
             bHasLanguage = pRef[k]->hasLocale( aTmpLocale );
         }
@@ -312,7 +312,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl(
 
     sal_Bool bRes = sal_True;
 
-    if (nLanguage == LANGUAGE_NONE  || !rWord.getLength())
+    if (nLanguage == LANGUAGE_NONE  || rWord.isEmpty())
         return bRes;
 
     // search for entry with that language
@@ -478,7 +478,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
 
     Reference< XSpellAlternatives > xRes;
 
-    if (nLanguage == LANGUAGE_NONE  || !rWord.getLength())
+    if (nLanguage == LANGUAGE_NONE  || rWord.isEmpty())
         return xRes;
 
     // search for entry with that language
@@ -688,7 +688,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
                     OUString aAddRplcTxt( xTmp->getReplacementText() );
 
                     // replacement text must not be in negative dictionary itself
-                    if (aAddRplcTxt.getLength() &&
+                    if (!aAddRplcTxt.isEmpty() &&
                         !SearchDicList( xDList, aAddRplcTxt, nLanguage, sal_False, sal_True ).is())
                     {
                         aProposalList.Prepend( aAddRplcTxt );
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index 7ac3bc4..0aa4fc1 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -174,7 +174,7 @@ Sequence< OUString > MergeProposalSeqs(
             const OUString  *pAlt   = j == 0 ? pAlt1 : pAlt2;
             for (i = 0;  i < nCount  &&  nIndex < MAX_PROPOSALS;  i++)
             {
-                if (pAlt[i].getLength() &&
+                if (!pAlt[i].isEmpty() &&
                     (bAllowDuplicates || !SeqHasEntry(aMerged, pAlt[i] )))
                     pMerged[ nIndex++ ] = pAlt[ i ];
             }
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index b8fd0c9..798c44f 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -126,7 +126,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
     Sequence< Reference< XMeaning > >   aMeanings;
 
     sal_Int16 nLanguage = LocaleToLanguage( rLocale );
-    if (nLanguage == LANGUAGE_NONE  || !rTerm.getLength())
+    if (nLanguage == LANGUAGE_NONE  || rTerm.isEmpty())
         return aMeanings;
 
     // search for entry with that language
-- 
1.7.5.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.