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

2023-03-08 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   14 
--
 linguistic/source/gciterator.cxx  |5 +++
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 6b6d59d04e0398d67e789db05b6071faf2255ec1
Author: Mike Kaganski 
AuthorDate: Wed Mar 8 12:56:06 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Mar 8 12:52:12 2023 +

Add some SAL_WARNs and SAL_INFOs

These help when debugging the LanguageTool issues.

Change-Id: I04bb84dbffc8e4c4e0b353f8e830fe66d8dff576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148199
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 06e9f4eddff1..91a027e6ec6b 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -126,7 +126,10 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 {
 std::unique_ptr curl(curl_easy_init());
 if (!curl)
+{
+SAL_WARN("languagetool", "CURL initialization failed");
 return {}; // empty string
+}
 
 // Same useragent string as in CurlSession 
(ucp/webdav-curl/CurlSession.cxx)
 curl_version_info_data const* const 
pVersion(curl_version_info(CURLVERSION_NOW));
@@ -341,20 +344,15 @@ sal_Bool SAL_CALL 
LanguageToolGrammarChecker::isSpellChecker() { return false; }
 
 sal_Bool SAL_CALL LanguageToolGrammarChecker::hasLocale(const Locale& rLocale)
 {
-bool bRes = false;
 if (!m_aSuppLocales.hasElements())
 getLocales();
 
 for (auto const& suppLocale : std::as_const(m_aSuppLocales))
-{
 if (rLocale == suppLocale)
-{
-bRes = true;
-break;
-}
-}
+return true;
 
-return bRes;
+SAL_INFO("languagetool", "No locale \"" << 
LanguageTag::convertToBcp47(rLocale, false) << "\"");
+return false;
 }
 
 Sequence SAL_CALL LanguageToolGrammarChecker::getLocales()
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index a43a990a886f..edd028e31e28 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -565,6 +565,11 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 }
 }
 }
+else // not found - quite normal
+{
+SAL_INFO("linguistic", "No grammar checker found for \""
+   << LanguageTag::convertToBcp47(rLocale, 
false) << "\"");
+}
 //  THREAD SAFE END 
 
 return xRes;


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

2020-07-20 Thread Noel Grandin (via logerrit)
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |5 -
 linguistic/source/lngsvcmgr.cxx |3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit fed392061613f71ecd04a485a8ec0de0595b441c
Author: Noel Grandin 
AuthorDate: Mon Jul 20 12:49:02 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 20 17:28:33 2020 +0200

fix SAL_WARN when instantiating Thesaurus

Before
commit 3fbadfa1ad41a3477804c592e06caec708c05218
lingucomponent: create instances with uno constructors
Thesaurus was constructed but Thesaurus::initialize was NOT being called
from GetAvailLocales.

However, we have some code marked "HACK" in
   cppuhelper/source/servicemanager.cxx
i.e.
   ServiceManager::createInstanceWithArguments
which DOES call initialize.

And we have code in GetAvailLocales which passes what Thesuarus
considers an invalid number of arguments, because all the other similar
services DO take 2 args (even though they don't use the second arg!)

So we have a bunch of temporary hack and backwards compat stuff
interacting, causing a SAL_WARN.

So make Thesauras::initialize a little more tolerant, which means we're
now initialising it, which is a change in behaviour, so if this commit
comes up a regression, we will need find another warn to stop the
warning.

Change-Id: I60e0ed1bd2d4fbccbc539b5536aba055a7dfc6c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99039
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 11f557cd1d54..a8b32bd4727f 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -466,10 +466,13 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any 
>& rArguments )
 return;
 
 sal_Int32 nLen = rArguments.getLength();
-if (1 == nLen)
+// Accept one of two args so we can be compatible with the call site in 
GetAvailLocales()
+// linguistic module
+if (1 == nLen || 2 == nLen)
 {
 Reference< XLinguProperties >   xPropSet;
 rArguments.getConstArray()[0] >>= xPropSet;
+assert(xPropSet);
 
 //! Pointer allows for access of the non-UNO functions.
 //! And the reference to the UNO-functions while increasing
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5c741fdd05e2..5891dbbd4fb1 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -73,8 +73,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
 {
 std::set< LanguageType > aLanguages;
 
-//! since we're going to create one-instance services we have to
-//! supply their arguments even if we would not need them here...
+// All of these services only use one arg, but need two args for 
compat reasons
 uno::Sequence< uno::Any > aArgs(2);
 aArgs.getArray()[0] <<= GetLinguProperties();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source linguistic/source lotuswordpro/source

2019-08-30 Thread Arkadiy Illarionov (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx   |   60 +--
 lingucomponent/source/languageguessing/guesslang.cxx|   18 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx|7 
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |   63 +--
 linguistic/source/convdic.cxx   |   47 --
 linguistic/source/convdiclist.cxx   |   34 -
 linguistic/source/dlistimp.cxx  |   13 
 linguistic/source/gciterator.cxx|   19 -
 linguistic/source/hyphdsp.cxx   |   18 -
 linguistic/source/lngopt.cxx|   30 -
 linguistic/source/lngprophelp.cxx   |  149 +++-
 linguistic/source/lngsvcmgr.cxx |  279 +---
 linguistic/source/misc.cxx  |   65 +--
 linguistic/source/misc2.cxx |   26 -
 linguistic/source/spelldsp.cxx  |   38 --
 linguistic/source/spelldta.cxx  |8 
 linguistic/source/thesdsp.cxx   |   29 -
 lotuswordpro/source/filter/LotusWordProImportFilter.cxx |   26 -
 18 files changed, 341 insertions(+), 588 deletions(-)

New commits:
commit 760a377f7148e623e9e16d24e66f54a401ecb946
Author: Arkadiy Illarionov 
AuthorDate: Thu Aug 29 00:51:02 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Fri Aug 30 14:15:57 2019 +0200

Simplify Sequence iterations in lingucomponent..lotuswordpro

Use range-based loops, STL and comphelper functions.

Change-Id: I975a9c09265976d5ce4a1d7ac2023cbb75bb7f28
Reviewed-on: https://gerrit.libreoffice.org/78242
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index bd38e3d470d4..2008395319e0 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +52,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -113,11 +115,10 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 uno::Sequence< OUString > aFormatList;
 aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators",
 "org.openoffice.lingu.LibHnjHyphenator", aFormatList );
-sal_Int32 nLen = aFormatList.getLength();
-for (sal_Int32 i = 0;  i < nLen;  ++i)
+for (const auto& rFormat : std::as_const(aFormatList))
 {
 std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
-aLinguCfg.GetActiveDictionariesByFormat( aFormatList[i] ) 
);
+aLinguCfg.GetActiveDictionariesByFormat( rFormat ) );
 aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
 }
 
@@ -132,57 +133,50 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 // is not yet supported by the list of new style dictionaries
 MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
 
-sal_Int32 numdict = aDics.size();
-if (numdict)
+if (!aDics.empty())
 {
 // get supported locales from the dictionaries-to-use...
-sal_Int32 k = 0;
 std::set aLocaleNamesSet;
 for (auto const& dict : aDics)
 {
-uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames );
-sal_Int32 nLen2 = aLocaleNames.getLength();
-for (k = 0;  k < nLen2;  ++k)
+for (const auto& rLocaleName : dict.aLocaleNames)
 {
-aLocaleNamesSet.insert( aLocaleNames[k] );
+aLocaleNamesSet.insert( rLocaleName );
 }
 }
 // ... and add them to the resulting sequence
-aSuppLocales.realloc( aLocaleNamesSet.size() );
-k = 0;
-for (auto const& localeName :  aLocaleNamesSet)
-{
-Locale aTmp( LanguageTag::convertToLocale(localeName));
-aSuppLocales[k++] = aTmp;
-}
+std::vector aLocalesVec;
+aLocalesVec.reserve(aLocaleNamesSet.size());
+
+std::transform(aLocaleNamesSet.begin(), aLocaleNamesSet.end(), 
std::back_inserter(aLocalesVec),
+[](const OUString& localeName) { return 
LanguageTag::convertToLocale(localeName); });
+
+aSuppLocales = comphelper::containerToSequence(aLocalesVec);
 
 //! For each dictionary and each locale we need a separate entry.
 //! If this results in more than one dictionary per locale than 
(for now)
 //! it is undefined which dictionary gets used.
 //! In the future the implementation should support using

[Libreoffice-commits] core.git: lingucomponent/source linguistic/source oox/source package/source pyuno/source reportdesign/source

2019-05-17 Thread Arkadiy Illarionov (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |6 ++---
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |6 ++---
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |   14 ++--
 linguistic/source/gciterator.cxx  |4 +--
 linguistic/source/hyphdsp.cxx |   14 ++--
 linguistic/source/lngsvcmgr.cxx   |   20 +-
 linguistic/source/spelldsp.cxx|8 +++
 linguistic/source/thesdsp.cxx |8 +++
 oox/source/core/filterbase.cxx|2 -
 oox/source/core/filterdetect.cxx  |2 -
 oox/source/core/xmlfilterbase.cxx |2 -
 oox/source/drawingml/chart/chartspaceconverter.cxx|4 +--
 oox/source/drawingml/customshapeproperties.cxx|2 -
 oox/source/drawingml/shape.cxx|6 ++---
 oox/source/export/chartexport.cxx |   10 -
 oox/source/export/drawingml.cxx   |   20 +-
 oox/source/export/shapes.cxx  |2 -
 oox/source/helper/zipstorage.cxx  |2 -
 oox/source/ole/olestorage.cxx |2 -
 package/source/xstor/owriteablestream.cxx |8 +++
 package/source/xstor/xstorage.cxx |2 -
 package/source/zipapi/XBufferedThreadedStream.cxx |2 -
 package/source/zipapi/XUnbufferedStream.cxx   |8 +++
 package/source/zipapi/ZipFile.cxx |   20 +-
 package/source/zipapi/ZipOutputEntry.cxx  |2 -
 package/source/zippackage/ZipPackage.cxx  |   16 +++---
 package/source/zippackage/ZipPackageFolder.cxx|2 -
 package/source/zippackage/ZipPackageStream.cxx|   16 +++---
 package/source/zippackage/zipfileaccess.cxx   |2 -
 pyuno/source/module/pyuno_adapter.cxx |2 -
 reportdesign/source/core/api/ReportDefinition.cxx |2 -
 reportdesign/source/filter/xml/xmlControlProperty.cxx |2 -
 reportdesign/source/filter/xml/xmlExport.cxx  |2 -
 reportdesign/source/ui/dlg/GroupExchange.cxx  |2 -
 reportdesign/source/ui/dlg/GroupsSorting.cxx  |8 +++
 reportdesign/source/ui/dlg/Navigator.cxx  |2 -
 reportdesign/source/ui/report/ReportController.cxx|   16 +++---
 reportdesign/source/ui/report/ReportSection.cxx   |2 -
 reportdesign/source/ui/report/ViewsWindow.cxx |2 -
 reportdesign/source/ui/report/propbrw.cxx |4 +--
 40 files changed, 128 insertions(+), 128 deletions(-)

New commits:
commit 0e4c542f7a862e681baf25f042bc3a928c14004f
Author: Arkadiy Illarionov 
AuthorDate: Fri May 3 22:11:02 2019 +0300
Commit: Michael Stahl 
CommitDate: Fri May 17 11:20:15 2019 +0200

Use hasElements to check Sequence emptiness in [l-r]*

Similar to clang-tidy readability-container-size-empty

Change-Id: Idd67f332b04857a39df26bad1733aae21236f105
Reviewed-on: https://gerrit.libreoffice.org/71764
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8ad50fa36915..bc4d91038a25 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -171,8 +171,8 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 k = 0;
 for (auto const& dict :  aDics)
 {
-if (dict.aLocaleNames.getLength() > 0 &&
-dict.aLocations.getLength() > 0)
+if (dict.aLocaleNames.hasElements() &&
+dict.aLocations.hasElements())
 {
 uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
 sal_Int32 nLocales = aLocaleNames.getLength();
@@ -218,7 +218,7 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& 
rLocale)
 MutexGuard  aGuard( GetLinguMutex() );
 
 bool bRes = false;
-if (!aSuppLocales.getLength())
+if (!aSuppLocales.hasElements())
 getLocales();
 
 const Locale *pLocale = aSuppLocales.getConstArray();
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 3462899714a2..64032ad14b2d 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -197,8 +197,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 m_DictItems.reserve(nDictSize);
 for (auto const& dict : aDics)
 {
-if (dict.aLocaleNames.getLength() > 0 &&
-dict.aLocations.getLength() > 0)
+   

[Libreoffice-commits] core.git: lingucomponent/source linguistic/source lotuswordpro/source mysqlc/source

2015-12-22 Thread Noel Grandin
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx   |1 -
 lingucomponent/source/languageguessing/guesslang.cxx|   12 +---
 linguistic/source/defs.hxx  |2 --
 lotuswordpro/source/filter/LotusWordProImportFilter.hxx |1 -
 lotuswordpro/source/filter/lwpbulletstylemgr.hxx|1 -
 mysqlc/source/mysqlc_connection.hxx |1 -
 6 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 1b80ad7246db991596f44ca58c4e4bd1e387e524
Author: Noel Grandin 
Date:   Tue Dec 22 09:58:45 2015 +0200

loplugin:unusedfields in lingu,lotuswordpro,mysqlc

Change-Id: I5866c8d95e04714e81a45e73bf00a430859a4327

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index 73fc628..e59ab94 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -70,7 +70,6 @@ class Hyphenator :
 sal_Int32 numdict;
 
 ::cppu::OInterfaceContainerHelper   aEvtListeners;
-Reference< XMultiServiceFactory >   rSMgr;
 linguistic::PropertyHelper_Hyphenation* pPropHelper;
 boolbDisposing;
 
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index 0cc0054..2ccea80 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -80,13 +80,12 @@ class LangGuess_Impl :
 {
 SimpleGuesser   m_aGuesser;
 boolm_bInitialized;
-css::uno::Reference< css::uno::XComponentContext >  m_xContext;
 
 virtual ~LangGuess_Impl() {}
 voidEnsureInitialized();
 
 public:
-explicit LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > 
const & rxContext);
+LangGuess_Impl();
 
 // XServiceInfo implementation
 virtual OUString SAL_CALL getImplementationName(  ) 
throw(RuntimeException, std::exception) override;
@@ -106,9 +105,8 @@ public:
 void SetFingerPrintsDB( const OUString &fileName ) throw 
(RuntimeException);
 };
 
-LangGuess_Impl::LangGuess_Impl(css::uno::Reference< 
css::uno::XComponentContext > const & rxContext) :
-m_bInitialized( false ),
-m_xContext( rxContext )
+LangGuess_Impl::LangGuess_Impl() :
+m_bInitialized( false )
 {
 }
 
@@ -351,9 +349,9 @@ Sequence SAL_CALL 
LangGuess_Impl::getSupportedServiceNames_Static(  )
  * @param xMgr service manager to if the components needs other component 
instances
  */
 Reference< XInterface > SAL_CALL LangGuess_Impl_create(
-Reference< XComponentContext > const & xContext )
+Reference< XComponentContext > const & )
 {
-return static_cast< ::cppu::OWeakObject * >( new LangGuess_Impl(xContext) 
);
+return static_cast< ::cppu::OWeakObject * >( new LangGuess_Impl );
 }
 
 // EXPORTED ### functions to allow for registration and creation of the 
UNO component
diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx
index ab86dfb..213f812 100644
--- a/linguistic/source/defs.hxx
+++ b/linguistic/source/defs.hxx
@@ -73,8 +73,6 @@ struct LangSvcEntries_Spell : public LangSvcEntries
 
 struct LangSvcEntries_Grammar : public LangSvcEntries
 {
-css::uno::Sequence< css::uno::Reference< css::linguistic2::XProofreader > 
>  aSvcRefs;
-
 LangSvcEntries_Grammar() : LangSvcEntries() {}
 explicit LangSvcEntries_Grammar( const OUString &rSvcImplName ) : 
LangSvcEntries( rSvcImplName ) {}
 };
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.hxx 
b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
index e2a953c..0babf81 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
@@ -48,7 +48,6 @@ protected:
 css::uno::Reference< css::uno::XComponentContext > mxContext;
 css::uno::Reference< css::lang::XComponent > mxDoc;
 OUString msFilterName;
-css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler;
 
 bool SAL_CALL importImpl( const css::uno::Sequence< 
css::beans::PropertyValue >& aDescriptor )
 throw (css::uno::RuntimeException, std::exception);
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx 
b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
index 98a83ab..878b2c3 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
@@ -97,7 +97,6 @@ private:
 bool m_bContinue;
 bool m_bIsBulletSkipped;
 LwpObjectID m_aCurrentNumberingID;
-std::unique_ptr m_pCurrentNumOverride;
 };
 
 inline void LwpBulletStyleMgr::SetFoundry(LwpFoundry* pFoundry)
diff --git a/mysqlc/source/mysqlc_connection.hxx 
b/mysqlc/source/mysqlc_connection.hxx
index 78ccd0d..a41f349 100644
--- a/mysqlc/source/mysqlc_connection.hxx
+++ b/mysqlc/source/mysqlc_connection.hxx
@@ -104,7 +104,6 @@ namespace connec