summaryrefslogtreecommitdiff
path: root/linguistic/source/dicimp.cxx
AgeCommit message (Collapse)AuthorFilesLines
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: linguisticStephan Bergmann1-1/+1
Change-Id: I0866cdaffa7059c30a65373efcd37a91b1b6e63e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski1-1/+1
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-18clang-tidy modernize-pass-by-value in linguisticNoel Grandin1-6/+7
Change-Id: Ia5fc81ed6e6e060d62e5ff42dccb06e36774a65c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134534 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-18DicEntry doesn't need lockingNoel Grandin1-7/+0
it never modifies state Change-Id: I040ba1bff6ea0567b13bf9d06150caefdcdaa522 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134529 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13add SvStream::ReadLine(OStringBuffer... to reduce OString allocationNoel Grandin1-3/+3
and use it where possible Change-Id: I3efc7a642f73661ce606c917c0323ba9948521c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134265 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin1-2/+2
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-11use more string_viewNoel Grandin1-5/+5
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic41cd4e3026d93b70a76fe1279c6de3abbe6b4a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132820 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-02use more string_viewNoel Grandin1-3/+3
Change-Id: I8be5ab687c2fe039e0a48d505b615f7cb88b633d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132454 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-02loplugin:stringviewparam convert methods using indexOfNoel Grandin1-4/+4
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann1-1/+1
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-02convert #defines to OUStringLiteralNoel Grandin1-2/+2
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: Idface893449b0ef2a3c5254865a300585d752fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119669 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-29loplugin:stringadd simplify some *StringBuffer operationsNoel Grandin1-7/+5
pulled from a larger patch which I created with a more permissive variant of this plugin Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-27use more string_view in tools/streamNoel Grandin1-2/+2
Change-Id: I2a957cd72d71fea717734488cdb3670e0bcdd6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-19use more string_view in comphelper::stringNoel Grandin1-1/+1
Change-Id: I5d27824694e38de540e5f1fcd8704f8777f65140 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114261 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann1-1/+1
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-11loplugin:stringviewNoel1-2/+2
Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 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-07-01Upcoming improved loplugin:staticanonymous -> redundantstatic: linguisticStephan Bergmann1-10/+10
Change-Id: I9f179db10c55f41e07c1f7fd519a58d68b7e6ad9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97614 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-23loplugin:makeshared in linguisticNoel Grandin1-14/+14
Change-Id: Id852ace32903e8bae622be36a7318d0f4f201832 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-15loplugin:buriedassign in l,o,p*Noel Grandin1-2/+8
Change-Id: Ib2dd157d43c4387eda009475311761fe2eb627cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92241 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-07loplugin:flatten in linguisticNoel Grandin1-19/+19
Change-Id: I5dc83e3f3697ccd6a482c799af267587a77563c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91799 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-19sal_Char->char in idlc..linguisticNoel Grandin1-7/+7
Change-Id: Ib30fe34123ad7e5d892e8db9c742e08c4ca8fcd2 Reviewed-on: https://gerrit.libreoffice.org/85477 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-07tdf#42949 Fix IWYU warnings in linguistic/Gabor Kelemen1-4/+1
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-20loplugin:constvars in i18npool..openclNoel Grandin1-1/+1
Change-Id: I82738a18ff116fdc78f07b453c93b1b631632caf Reviewed-on: https://gerrit.libreoffice.org/77775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-15improve loplugin simplifyconstructNoel Grandin1-2/+2
to find stuff like OUString s = OUString("xxx") Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04 Reviewed-on: https://gerrit.libreoffice.org/70697 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-04tdf#42949 Fix IWYU warnings in include/linguistic/Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Iec1ca76e9b3a0896a732ab2b7fd34dd5a7f219fb Reviewed-on: https://gerrit.libreoffice.org/68367 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-29loplugin:stringconstant look for unnecessary OString constructor useNoel Grandin1-5/+5
and tweak the methods in check.hxx to make them more flexible when called with dc.Class(xxx ? "foo" : "bar") Change-Id: I881fe628f22121ced4d8849715d6b1c92b092da1 Reviewed-on: https://gerrit.libreoffice.org/64207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@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-26tdf#117620 Localize the temporary IgnoreAllList dictionarys nameGabor Kelemen1-6/+0
Also give it a human readable original name Change-Id: I86060badac145e7b60cf7dc2e67e16e7c84c2837 Reviewed-on: https://gerrit.libreoffice.org/56143 Tested-by: Jenkins Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com> Tested-by: Heiko Tietze <tietze.heiko@gmail.com>
2018-04-07assert on empty lineCaolán McNamara1-1/+1
Change-Id: Ifa3cccb13a3595998d4c85957a69fb7ecb047dd0 Reviewed-on: https://gerrit.libreoffice.org/52525 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-01-12More loplugin:cstylecast: linguisticStephan Bergmann1-6/+6
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ic1b6e8fbf3ba8d3477ee3f5539667427d26c2f43
2018-01-05Add optional title: field to user dictionariesLászló Németh1-2/+36
LibreOffice stores the title of an user dictionary only in its file name, but special characters in file names can result configuration problem for user dictionaries shipped with LibreOffice. Optional "title:" field of user dictionaries supports custom titles with spaces and other UTF-8 characters. Change-Id: Idbc4c41a2e08f50cfc0fc0d25e960084f5773bec Reviewed-on: https://gerrit.libreoffice.org/47397 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
2017-11-22drop duplicate methodCaolán McNamara1-3/+3
Change-Id: Idadd0a64e41cd02f5167b275081c3576a6224b12 Reviewed-on: https://gerrit.libreoffice.org/45075 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-17tdf#113739 add "Grammar By" feature to user dictionariesLászló Németh1-1/+35
Language-specific user dictionaries (en-US, de-DE, etc.) have got a new "Grammar By" field to specify optional automatic affixation and compounding of the new words by adding an example dictionary word. Test example: Create an en-US user dictionary. Add the new word "crowdfund" to it, also an example, the Hunspell en-US dictionary word "fund" in the optional "Grammar By" field. This way, the word "crowdfund" will be recognized by the spell checker with suffixes of the word "fund", too: crowdfund’s, crowdfunds, crowdfunder, crowdfunders and crowdfunding. Hunspell dictionaries with compound flag usage (German, Hungarian, etc.) can support automatic compounding of the new words, too. Change-Id: Id70dbee4544643967153f730ae64938e5cee0c82 Reviewed-on: https://gerrit.libreoffice.org/44562 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2017-10-23loplugin:includeform: linguisticStephan Bergmann1-2/+2
Change-Id: I4a1db5d06511221a656367e7b0457144335ae10c
2017-07-20loplugin:constparams in linguisticNoel Grandin1-1/+1
Change-Id: I7495c476b52a804971eaa97db011530842025fa9 Reviewed-on: https://gerrit.libreoffice.org/40221 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-21convert ErrCode to strong typedefNoel Grandin1-19/+19
would have preferred to re-use o3tl::strong_int, of which this is a modified copy, but there are lots of convenience accessors which are nice to define on the class. Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a Reviewed-on: https://gerrit.libreoffice.org/38497 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-26use strong_int for LanguageTypeNoel Grandin1-7/+8
Change-Id: If99a944f7032180355da291ad283b4cfcea4f448 Reviewed-on: https://gerrit.libreoffice.org/36629 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-24clang-tidy readability-simplify-boolean-expr in hwpfilter..lotuswordproNoel Grandin1-4/+1
Change-Id: I945d3fe6af5f88937b341dfc3696bf1d36344862 Reviewed-on: https://gerrit.libreoffice.org/36874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-23loplugins:redundantcast teach it about c-style typedef castsNoel Grandin1-1/+1
Change-Id: I1ac11a2481c0f4d8be1e1fd7c7637ac0ece3d65c Reviewed-on: https://gerrit.libreoffice.org/35558 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-26Remove dynamic exception specificationsStephan Bergmann1-26/+0
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-11Some loplugin:conststringvar/stringconstant improvements: linguisticStephan Bergmann1-1/+1
Change-Id: Ic41c77c24f43503a7984bae3520948917ec6bb23
2017-01-10New loplugin:conststringvar: linguisticStephan Bergmann1-3/+3
Change-Id: Ia9bf537071df32879c7cc92744c12556025f82ff
2016-11-02loplugin:oncevar in helpcompiler..reportdesignNoel Grandin1-3/+1
Change-Id: I2dc57931fb230953c285aeb18f57c0a41fedafcb Reviewed-on: https://gerrit.libreoffice.org/30463 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-29loplugin:literaltoboolconversionStephan Bergmann1-2/+2
Change-Id: I99859433f3e3541c8e44248e4a29ef2c5fb24845
2016-09-29Resolves: tdf#67555 writeFile honors ntfs symlinks as it turns outCaolán McNamara1-67/+30
and correctly truncates the file without replacing it by a delete + recreate. So we can drop the custom temp directory+move code of fdo#42122 - truncate files that shrink to avoid dictionary corruption This reverts commit 28300209604ee1bb8e5050322b29e95a07f679d8. and so don't need fdo#66420: fix user dictionaries on Windows This reverts commit d68de5195605bd9236851e0714dd9b03b0f5f3be. Change-Id: I7f2010f4113f78cd0667632253b56055d189cbff
2016-09-15replace sal_Size with std::size_t (or sal_uInt64 for SvStream pos)Michael Stahl1-2/+2
... except in include/rtl, include/sal, include/uno, where sal_Size is retained for compatibility, and where callers of rtl functions pass in pointers that are incompatible on MSVC. Change-Id: I8344453780689f5120ba0870e44965b6d292450c
2016-08-30Related: tdf#83376 fallback to known in linguistic context is wrong, always.Eike Rathke1-1/+1
Change-Id: I2f06818e6569fd7e59b94d11b69808a2b81490d5
2016-06-12convert more DBG_ASSERT(false to SAL_WARNNoel Grandin1-2/+2
Change-Id: Ie52f28f28c67a91c4d3d4517d5c6a466890c7a55 Reviewed-on: https://gerrit.libreoffice.org/26195 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-06tools: rename SvStream::Read/Write to ReadBytes/WriteBytesMichael Stahl1-4/+4
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a Reviewed-on: https://gerrit.libreoffice.org/25972 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>