summaryrefslogtreecommitdiff
path: root/linguistic/source/gciterator.cxx
AgeCommit message (Collapse)AuthorFilesLines
8 daysloplugin:ostr in linguisticNoel Grandin1-9/+9
Change-Id: Iebc2db1c5750a8cea835722c396d6f708fe6e0be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167426 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-04Revert "osl::Mutex->std::mutex in GrammarCheckingIterator"Stephan Bergmann1-47/+43
This reverts commit 829fa53fe877d0f0fc33d634fa7fbfbed23b7676, which started all sorts of `make check` tests to hang for me due to a recursive locking attempt in > #5 std::mutex::lock (this=0x7f6af81e62c0) at ~/gcc/inst/include/c++/14.0.1/bits/std_mutex.h:113 > #6 std::unique_lock<std::mutex>::lock (this=<synthetic pointer>) at ~/gcc/inst/include/c++/14.0.1/bits/unique_lock.h:147 > #7 std::unique_lock<std::mutex>::unique_lock (this=<synthetic pointer>, __m=...) at ~/gcc/inst/include/c++/14.0.1/bits/unique_lock.h:73 > #8 GrammarCheckingIterator::NextDocId (this=0x7f6af81e6260) at linguistic/source/gciterator.cxx:317 > #9 GrammarCheckingIterator::GetOrCreateDocId (this=this@entry=0x7f6af81e6260, xComponent=uno::Reference to (SwXTextDocument *) 0x7f6af8430ec8) at linguistic/source/gciterator.cxx:339 > #10 0x00007f6b3b9e9da9 in GrammarCheckingIterator::startProofreading (this=0x7f6af81e6260, xDoc=<optimized out>, xIteratorProvider=<optimized out>) at linguistic/source/gciterator.cxx:773 > #11 0x00007f6b16441ec3 in SwDoc::StartGrammarChecking (this=<optimized out>, bSkipStart=bSkipStart@entry=false) at sw/source/core/doc/docnew.cxx:180 > #12 0x00007f6b164c4eae in sw::DocumentTimerManager::DoIdleJobs (this=0x7f6afad005a0) at sw/source/core/doc/DocumentTimerManager.cxx:169 > #13 0x00007f6b3e83a68b in Scheduler::CallbackTaskScheduling () at vcl/source/app/scheduler.cxx:509 > #14 0x00007f6b3eb1725f in SalTimer::CallCallback (this=<optimized out>) at vcl/inc/saltimer.hxx:54 > #15 SvpSalInstance::CheckTimeout (this=this@entry=0xffebe0, bExecuteTimers=bExecuteTimers@entry=true) at vcl/headless/svpinst.cxx:157 > #16 0x00007f6b3eb1761d in SvpSalInstance::ImplYield (this=this@entry=0xffebe0, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:395 > #17 0x00007f6b3eb17cd5 in SvpSalInstance::DoYield (this=0xffebe0, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:467 > #18 0x00007f6b3e86aa44 in ImplYield (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:394 > #19 0x00007f6b3e86b13b in Application::Execute () at vcl/source/app/svapp.cxx:369 > #20 0x00007f6b3c8e715f in desktop::Desktop::Main (this=0x7ffe5e22fcb0) at desktop/source/app/app.cxx:1615 > #21 0x00007f6b3e87e6fb in ImplSVMain () at vcl/source/app/svmain.cxx:229 > #22 0x00007f6b3e87e9c5 in SVMain () at vcl/source/app/svmain.cxx:261 > #23 0x00007f6b3c91de37 in soffice_main () at desktop/source/app/sofficemain.cxx:93 > #24 0x000000000040078b in sal_main () at desktop/source/app/main.c:51 > #25 main (argc=argc@entry=8, argv=argv@entry=0x7ffe5e22feb8) at desktop/source/app/main.c:49 Change-Id: I60b8b0ba00cae691d6089325e4379a86221dc95b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165764 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-04-03osl::Mutex->std::mutex in GrammarCheckingIteratorNoel Grandin1-43/+47
Change-Id: Icda197a9c1a20b245079c91a7a7b2301a5955b09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165736 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-14lok: implement a joinThreads function - to wind down thread pools.Michael Meeks1-0/+8
Necessary to do this before forking on Unix systems; use a dynamic_cast interface since this is all for internal use. Change-Id: I8a911322acd4ec5654eb0d14804c09d513a0bd4b Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163335 Tested-by: Jenkins
2024-01-09avoid null deref of xIgnoreAllCaolán McNamara1-1/+1
Change-Id: Ib8e3309c046a74ca13f88fd0a668f3e1d6b909b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161802 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161815 Tested-by: Jenkins
2024-01-09tdf#150716 - Partially solves the issue.Gökay Şatır1-26/+42
This PR fixes the IgnoreAll issue. "Ignore" functionality needs another PR. Grammar checker and spell checker have different implementations. IgnoreAll functionality is implemented for spell checker but not grammar checker. This PR implements IgnoreAll for grammar checkers. Note: Ignore All function is valid per editing session. The ignored words is reset after the session is closed. Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I7c2b77b18e0a26a6a1c5fa9e8e66075a34612884 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159813 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit c0a619aa945c852652dc353dbe4c42cabbc2b779) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161699 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-06-02Simplify a bitMike Kaganski1-5/+2
Change-Id: I0d03a1c68cec9ff0edc2c14f3837054a2c693a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152534 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-02tdf#155647: Pass XFlatParagraph by normal Reference, not WeakReferenceMike Kaganski1-4/+3
Since commit a7ce722b476c4bb0c9a113ae0c2759181edfe48f (tdf#155232: drop m_aFlatParaList from SwXFlatParagraphIterator, 2023-05-13), the instances of XFlatParagraph are not cached in its iterator. Hence, the instances created in GrammarCheckingIterator to pass to AddEntry got immediately destroyed upon the scope end, before the checking thread (where weak references were passed) had a chance to create own hard references. Then GrammarCheckingIterator::DequeueAndCheck found that xFlatPara was empty, and exited. Just pass hard references there. The iterator was passed to the thread by hard reference in FPEntry anyway; and so, the use of weak reference to flat paragraph objects provided no benefit, when the iterator kept hard references. Change-Id: Ib56652d88b9a5c6f20aa3d70fed18f8be0d3a3df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152554 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-06Use getXWeak in linguisticMike Kaganski1-1/+1
Change-Id: I1202763917dab414e8bc540bd89d736e74fa1450 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150858 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-08Add some SAL_WARNs and SAL_INFOsMike Kaganski1-0/+5
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 <mike.kaganski@collabora.com>
2023-03-05tdf#152459: fallback to language-only when looking for grammar checkerMike Kaganski1-16/+33
LanguageTool registers itself for languages like "en-US", "es-AR", "de-DE"; but also for generic "en", "es", "de". When the requested language, like "fr-CH" or "es-PH", is not found in the registered grammar checkers, the fallback strings will be attempted. Change-Id: Id460db8d378f246ea98191d22bdb3537fd1aee1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148201 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-05No need to use a clearable guard hereMike Kaganski1-1/+1
Change-Id: I34a3aba881ae3591130fb3a0d7ae9eb768f615bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148267 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-05Swap instead of copy-assignmentMike Kaganski1-1/+1
Change-Id: I5f54dad94cde60dd299f3db22c19a3565a2524a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148268 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-17Properties SortedTextId and DocumentElementsCount added for grammar checkFred Kruse1-0/+2
The LanguageTool extension (LT extension) runs not only a grammar check on the level of sentences and paragraphs, some rules work on the level of many paragraphs or full text. The LT extension uses a complex caching mechanism to support this feature. A mapping from a check request to the cached to the (flat)paragraphs is necessary. Until now, this is done by a time-consuming and error-prone mechanism. The adding of the SortedTextId introduce a feature, a paragraph to be checked can be fast and easy identified. The flatparagraphs also can easily be mapped to cursors to get additional information of the paragraph, used for further features of LT extension. The added Property DocumentElementsCount to flatparagraphs and doProofreading gives the extension the hint to recreate the cache. Change-Id: I4b6b58bba4dfb3e870fe7b71fd8537ee9ffd6476 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142251 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-01-05Revert all the recent loplugin:unocast changesStephan Bergmann1-11/+0
...as obsoleted by ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for dynamic_cast on UNO proxy objects". This reverts all of: 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c "loplugin:unocast (framework::Desktop)" 03efbf72f4ddf7a84aa8aabef348331bd4b75e8a "loplugin:unocast (vclcanvas::TextLayout)" 80099fdd51a69eaa6c36ca88ef772810e4a777fa "loplugin:unocast (SalGtkXWindow)" cc147f576d8687fb79c77d47d41dc4ba1678a469 "loplugin:unocast (sdext::presenter::CachablePresenterView)" 40db42be1d8fd0f9c6c8c5ba3767ddb9ee2034c2 "loplugin:unocast (vclcanvas::CanvasFont)" 2d1e7995eae29e2826449eb5179f5fae181794a5 "loplugin:unocast (CairoColorSpace)" 4c0bbe4bd97636207cf71a6aa120c67698891da9 "loplugin:unocast (canvas::ParametricPolyPolygon)" 89803666621c07d1b1ac9d3bd883f0ca192a91a0 "loplugin:unocast (vclcanas::CanvasBitmap)" d5e0c2c8db71878d21c2a7255af08cf5f9a6dd04 "loplugin:unocast (sfx2::DigitalSignatures)" c0c4519e0d5b555f59bbc04cc616454edfd1f4ce "loplugin:unocast (VCLXAccessibleComponent)" feb8b833a6245d42400f42a0bc789dc84594ee6f "loplugin:unocast (VCLXDialog)" 1fa58cc6cc9c3849753342a5d9a6ddfa461b5e66 "loplugin:unocast (VCLXMultiPage)" f481f036deb1b1b46f3038074c4659f3a91b9c6c "loplugin:unocast (DocumentSettingsSerializer)" 73df933f5fa5932f94e5a1b338a3eda00a9ce354 "loplugin:unocast (css::embed::EmbeddedUpdate)" 420165ab0ef03c0467f9d17f504de2d2fc78f0e6 "loplugin:unocast (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)" 9abe8ee067e6c00f19d8a13346d53c4641c27166 "loplugin:unocast (MutableTreeNode)" 9f3022ceb036f23b4b0994c3e2fbd1001bff225a "loplugin:unocast (VCLXTabPage)" 1be70dda02c12a60778b7607cff2520ae1aa611e "loplugin:unocast (vcl::unotools::VclCanvasBitmap)" d6a70bb641b96e8e5616448c2378131ed62658b4 "loplugin:unocast (basegfx::unotools::UnoPolyPolygon)" 5a14f009e6782c077463c8cbb8e9cea3d7950107 "loplugin:unocast (xmlsecurity::Certificate)" 99009c9535dfa3e0d838989ccc7d84bfa2320ff4 "loplugin:unocast (sd::Annotation)" 0c7585c5fa78887e5459885ed744e8044fd76137 "loplugin:unocast (sd::TextApiObject)" 24e14afd1bfcaed6c200ab081973fba7e47267ca "loplugin:unocast (SignatureVerifierImpl)" 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 "loplugin:unocast (pcr::PropertyEventTranslation)" a97e2d2702d9a6f37775ccee2c08c4f3b2479c4b "loplugin:unocast (RangePageBreaks)" 19dfdf86ad1f5b08041d8b7a9f196caf881231ab "iloplugin:unocast (pcr::OFormattedNumericControl)" f9785ea595fd8e911f6370e836fa579225b9e571 "loplugin:unocast (frm::OInterfaceContainer)" 5e5f40a4a92a31b0932c690219d002fcf18598cf "loplugin:unocast (ScVbaShapes)" 27b35b2c215b4832d4378ec3a7ecbba926552d06 "loplugin:unocast (ScVbaShapeRange)" cb3108f860065928552a86cf8acc4b3a95718ecf "cid#1517812 Dereference null return value" feba0ddb1521d1142560fe54b7d7696ee910237f "loplugin:unocast (weld::TransportAsXWindow)" 4d6c23216559eb48f9943bb49d6e475a6d64ba15 "loplugin:unocast (oox::ForumlaImExportBase)" 4844c096a8ab6a9a620c410a0949d4499f12a504 "loplugin:unocast (cairocanvas::SurfaceProvider)" 9a0b523e0a84d403b9092176ccec4b3e3efe42d0 "loplugin:unocast (cairocanvas::CanvasBitmap)" 8a5648d8e59b4b007dbbf3824777c19a21efc61e "loplugin:unocast (cairocanvas::TextLayout)" 28c27a0623bc78a0590858f97d03b620985bc84c "loplugin:unocast (cairocanvas::CanvasFont)" 53bc223cb3288e32a417696ee61c29e5f01f209d "loplugin:unocast (cairocanvas::RepaintTarget)" 5f70b0b9f6bc4ab145ddbd9155590ed4a3b1b9ec "loplugin:unocast (SvXMLImport)" 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 "loplugin:unocast (VCLXWindow)" 88b4f966202717cd4ad38a30a8eda22c3e69ed35 "loplugin:unocast (sfx2::sidebar::SidebarController)" f1b7a69b280aefe2f1b3b0f32193494fd765f2bd "loplugin:unocast (SvxLineStyleToolBoxControl)" ba76f0ba7e8de4d2953739c952004b7d9af47197 "loplugin:unocast (i18npool::Calendar_gregorian)" 840154daf934d8df52ead1cb7acd798c4d30f007 "loplugin:unocast (framework::AddonsToolBarWrapper)" b0e9c4c5f063cefa9557810e3349bdb9c7493091 "loplugin:unocast (GrammarCheckingIterator)" 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac "loplugin:unocast (ucb::ucp::ext::Content)" 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a "loplugin:unocast (basic::SfxScriptLibraryContainer)" 9e73ff9fce12e102bb3c3cea8d8bb96c88f2c9ad "loplugin:unocast (sdext::presenter::PresenterNotesView)" a98acca8fbc38d3fd5600ae5056a8e42b6d8a40d "loplugin:unocast (SelectionChangeHandler)" c0b59ad6e35b0cb0dea0821e95f95569739078c1 "Consistently use comphelper::getSomethingImpl<I>(aIdentifier, this)" 276e3ccbdd3259ec3daf8a1a98fa7f406b14e21c "loplugin:unocast (vclcanvas::RepaintTarget)" Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-14loplugin:unocast (GrammarCheckingIterator)Stephan Bergmann1-0/+11
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I4ecaa3cfafbb2e01ede956e4f3f6d58f40bdbb57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144146 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann1-1/+1
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-15rtl::Static->thread-safe static in linguisticNoel Grandin1-19/+25
Change-Id: Ie028e0d93f4dec4974d357900a2d5d84275a9a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125209 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-30Prepare for removal of non-const operator[] from Sequence in linguisticMike Kaganski1-2/+1
Change-Id: I6eda1416ca0421a48bf9811343850aa504019d57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124374 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-01clang-tidy:readability-redundant-member-initNoel Grandin1-1/+0
Change-Id: I78339f1df1f0c55c7edaa552940b07d1ada3aeb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121386 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-09Simplify Sequences initializations (i*->p*)Julien Nabet1-7/+2
Change-Id: I6bf0eaa2233de2487d90a2f9ae7de263b4ddf1bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116865 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-03-10Drop 'static_cast<cppu::OWeakObject*>' syntactic noiseMike Kaganski1-1/+1
... where the object is created in-place, and its type is known Change-Id: Ifabfcf2f3ad0d60152f14e8d970c1faa42115288 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112256 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-01OSL_FAIL.*exception -> TOOLS_WARN_EXCEPTIONNoel1-1/+1
Change-Id: I6800e23ead2767d245d5da71d2d40e0f8a6d7e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106859 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10tdf#42949 Fix new IWYU warnings in directories [h-r]*Gabor Kelemen1-2/+0
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I886b6f446293d3b1cfbf4ae05e8dbd7fabab9f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105510 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-10-02Use the new single-instance="true" attribute in linguisticStephan Bergmann1-4/+2
Change-Id: I87343e3760d3e583fc6b6ad55028e51bd402b536 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103851 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-14linguistic: create instances with uno constructorsNoel Grandin1-40/+9
See tdf#74608 for motivation. Change-Id: I1ee71beb89d778213fa4bb22fb7d350ed77879c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98707 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-01Upcoming improved loplugin:staticanonymous -> redundantstatic: linguisticStephan Bergmann1-4/+4
Change-Id: I9f179db10c55f41e07c1f7fd519a58d68b7e6ad9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97614 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-07loplugin:flatten in linguisticNoel Grandin1-35/+35
Change-Id: I5dc83e3f3697ccd6a482c799af267587a77563c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91799 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-06add information to xProofrader in gciterator.cxxFred Kruse1-4/+10
the in formation gives the reason for the initiataed proof. This helps to get the location of the checked paragraph inside the test. This is needed for running text level rules e.g. in LanguagTool Change-Id: I559a07a74932134c6dbb04fb9f6137e623e02d5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89854 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-01-28New loplugin:unsignedcompareStephan Bergmann1-2/+3
"Find explicit casts from signed to unsigned integer in comparison against unsigned integer, where the cast is presumably used to avoid warnings about signed vs. unsigned comparisons, and could thus be replaced with o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx) o3tl::make_unsigned requires its argument to be non-negative, and there is a chance that some original code like static_cast<sal_uInt32>(n) >= c used the explicit cast to actually force a (potentially negative) value of sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the cast to avoid a false "signed vs. unsigned comparison" warning in a case where n is known to be non-negative. It appears that restricting this plugin to non- equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=) is a useful heuristic to avoid such false positives. The only remainging false positive I found was 0288c8ffecff4956a52b9147d441979941e8b87f "Rephrase cast from sal_Int32 to sal_uInt32". But which of course does not mean that there were no further false positivies that I missed. So this commit may accidentally introduce some false hits of the assert in o3tl::make_unsigned. At least, it passed a full (Linux ASan+UBSan --enable-dbgutil) `make check && make screenshot`. It is by design that o3tl::make_unsigned only accepts signed integer parameter types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses which would in general be suspicious. But the STATIC_ARRAY_SELECT macro in include/oox/helper/helper.hxx is used with both signed and unsigned types, so needs a little oox::detail::make_unsigned helper function for now. (The ultimate fix being to get rid of the macro in the first place.) Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-19sal_Char->char in idlc..linguisticNoel Grandin1-1/+1
Change-Id: Ib30fe34123ad7e5d892e8db9c742e08c4ca8fcd2 Reviewed-on: https://gerrit.libreoffice.org/85477 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-24cppcheck: performing init in init list (hwpfilter, i., l.)Julien Nabet1-1/+1
Change-Id: Idf5b7be45d48076fbe191fbf1a2fa63c6da71902 Reviewed-on: https://gerrit.libreoffice.org/83617 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-07tdf#42949 Fix IWYU warnings in linguistic/Gabor Kelemen1-14/+3
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ida2903087ae5752a65c0ce099449645d91a83f29 Reviewed-on: https://gerrit.libreoffice.org/81971 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-30Simplify Sequence iterations in lingucomponent..lotuswordproArkadiy Illarionov1-11/+8
Use range-based loops, STL and comphelper functions. Change-Id: I975a9c09265976d5ce4a1d7ac2023cbb75bb7f28 Reviewed-on: https://gerrit.libreoffice.org/78242 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
2019-08-17tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctorJulien Nabet1-2/+1
in hwpfilter, include/test, io, linguistic, oox, pyuno, reportdesign Change-Id: I5c265c4fde85dd6d7faab8ae82809c4a0e6dd69b Reviewed-on: https://gerrit.libreoffice.org/77646 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-16use more TOOLS_WARN_EXCEPTIONNoel Grandin1-4/+2
Change-Id: Ic21ea11ff106e0732bb8fa600ef39a549d7bda86 Reviewed-on: https://gerrit.libreoffice.org/77569 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): linguisticStephan Bergmann1-1/+1
Change-Id: I46da5784c74829873f92a341c388b142d29547b4 Reviewed-on: https://gerrit.libreoffice.org/76664 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-20loplugin:referencecasting in linguisticNoel Grandin1-2/+2
Change-Id: Iff53942bebb1481666ae4469e16089d54669954f Reviewed-on: https://gerrit.libreoffice.org/75973 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-15loplugin:logexceptionnicely in linguistic..ooxNoel Grandin1-4/+2
Change-Id: I3f96494f5fecb2f1011578b768198c1204147202 Reviewed-on: https://gerrit.libreoffice.org/74099 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-17Use hasElements to check Sequence emptiness in [l-r]*Arkadiy Illarionov1-2/+2
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 <Michael.Stahl@cib.de>
2019-04-10Fix double-clear of clearable mutex guardMike Kaganski1-42/+48
Change-Id: I91f04cae91cbb5510f70baaf8c31ecc59f6402c7 Reviewed-on: https://gerrit.libreoffice.org/70479 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-03-07log nice exception messages whereever possibleNoel Grandin1-4/+7
Change-Id: Idd125c18bee1a39b9ea8cc4f8c55cddfd37c33e1 Reviewed-on: https://gerrit.libreoffice.org/68579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-25tdf#120703 PVS: V560 A part of conditional expression is always true/falseMike Kaganski1-8/+5
Change-Id: I8d98aa7dd77fbd79611b8a4aba77e8c378fd1cae Reviewed-on: https://gerrit.libreoffice.org/63981 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-25tdf#120703 PVS: fix possible buffer over-read when iterating stringMike Kaganski1-1/+2
V560 A part of conditional expression is always true: nStartPos < nLen. Change-Id: I2ae8634bd656e857724615d5187a14bd087598eb Reviewed-on: https://gerrit.libreoffice.org/63958 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-14tdf#42949 Fix IWYU warnings in include/svl/*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ide75232858599c275e023c2300201090acd22307 Reviewed-on: https://gerrit.libreoffice.org/63237 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-09-17New loplugin:externalStephan Bergmann1-1/+5
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-10tdf#42949 Fix IWYU warnings in include/cppuhelper/*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib420e9216b8313f5ed7634ec375e39ceb741fd45 Reviewed-on: https://gerrit.libreoffice.org/59297 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-30Add missing sal/log.hxx headersGabor Kelemen1-0/+1
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from l10ntools to reportdesign Change-Id: Ia2dc93dd848c2dc0b6a8cb6e19849c614ec55198 Reviewed-on: https://gerrit.libreoffice.org/58205 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-02mergedlibs failure with duplicate SwXStringKeyMapCaolán McNamara1-8/+8
just rename this one for a quick fix Change-Id: Iae9152356640c3454a73b56f7e097d084d8eb3a0 Reviewed-on: https://gerrit.libreoffice.org/55210 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-01linguistic: add functionality to change spellcheck colorFred Kruse1-0/+62
This adds a way for the grammar checker extension to change color and line type of the 'wiggly lines' LibreOffice uses to highlight spelling or grammar errors. Change-Id: Idd669cf362da34f8cfcdcec14f1f80df1ddb1f9e Reviewed-on: https://gerrit.libreoffice.org/54927 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>