summaryrefslogtreecommitdiff
path: root/l10ntools/source
AgeCommit message (Collapse)Author
2022-11-23Work around system(3) dropping DYLD_LIBRARY_PATH on macOSStephan Bergmann
...which caused `make translations` fail for me with > [POT] pot.done > dyld[96290]: Library not loaded: @__VIA_LIBRARY_PATH__/libuno_sal.dylib.3 > Referenced from: <CD4F28D6-E3BE-3126-B861-C90BF3E14492> .../workdir/LinkTarget/Executable/cfgex > Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@__VIA_LIBRARY_PATH__/libuno_sal.dylib.3' (no such file), '/usr/local/lib/libuno_sal.dylib.3' (no such file), '/usr/lib/libuno_sal.dylib.3' (no such file, not in dyld cache) > Error: Failed to execute .../workdir/LinkTarget/Executable/cfgex -i .../connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu -o .../workdir//pot/connectivity/registry/ado/org/openoffice/Office/DataAccess.pot (This is the opposite case to 17cfd43e28c45626b1e0990bd0e51fdc97409ebe "Avoid external processes picking up instdir/program/libxml2.so.2". Here, the executables called from Executable_localize are LO-internal executables that need the libraries in instdir/. There, the scripts called from Executable_localize in turn only call external tools that shall not accidentally pick up LO-internal libraries from instdir/.) Change-Id: Ib1aa240ee47a21d14ec0463fee85bebe82453cee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143118 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-22Simplify previous fixStephan Bergmann
...e735de2051143347b7283c85ad80b0e2412522dc "Avoid some unnecessary, wrong downcasts during `make translations" Change-Id: If6110e16698302b3d43b2192cf0f0e0d0fddb57b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143026 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-21Avoid external processes picking up instdir/program/libxml2.so.2Stephan Bergmann
...which is a problem in ASan builds, as seen with a failing `make check`: > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > Traceback (most recent call last): > File ".../solenv/bin/uiex", line 25, in <module> > input = check_output(["xgettext", "--add-comments", "--no-wrap", ifile, "-o", "-"], encoding="UTF-8") > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib64/python3.11/subprocess.py", line 465, in check_output > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib64/python3.11/subprocess.py", line 569, in run > raise CalledProcessError(retcode, process.args, > subprocess.CalledProcessError: Command '['xgettext', '--add-comments', '--no-wrap', '.../basctl/uiconfig/basicide/ui/basicmacrodialog.ui', '-o', '-']' returned non-zero exit status 127. > Error: Failed to execute .../solenv/bin/uiex -i .../basctl/uiconfig/basicide/ui/basicmacrodialog.ui -o .../workdir//pot/basctl/messages.pot The solution is similar to e854abe076155fc085b56549ced50b3ee9a095d2 "Avoid external processes picking up instdir/program/libnspr4.so" used in various tests. And as Executable_localize appears to only be called in that one place in the recipe of `make translations`, for simplicity make the library path override a required fourth argument for that executable. Change-Id: Ia6326ac0bb12ea75a8b3df51f7fbf12b88aca634 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142999 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2022-11-20Clean up CfgParser::aStackStephan Bergmann
This is apparently some very old, very poor XML parsing code full of questionable design decisions. The silliness of pushing onto the opened-element stack also entities that don't have a closing tag (but which cannot easily be changed, see the added comment about CfgStack::GetAccessPath) caused consistent memory leaks when Executable_cfgex is executed during the build. While those leaks are harmless, they might cause people to nevertheless try to clean them up in various ways (see the abandoned <https://gerrit.libreoffice.org/c/core/+/142718> "asan: fix leak in ExecuteAnalyzedToken/Push"), so just clean up those broken-by-design excess aStack elements. Change-Id: I849109906c6b102d9aa90300c2bada360c727d4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-20Avoid some unnecessary, wrong downcasts during `make translations`Stephan Bergmann
> l10ntools/source/xmlparse.cxx:491:51: runtime error: downcast of address 0x603000000610 which does not point to an object of type 'XMLParentNode' > 0x603000000610: note: object is of type 'XMLDefault' > 00 00 00 00 30 44 a7 dd a0 55 00 00 00 05 10 6e a4 7f 00 00 80 00 00 00 60 60 00 00 00 00 00 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'XMLDefault' > #0 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:491:51 > #1 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:481:9 > #2 in HelpParser::CreatePO(rtl::OString const&, rtl::OString const&, XMLFile*, std::basic_string_view<char, std::char_traits<char>>) at l10ntools/source/helpmerge.cxx:91:20 > #3 in sal_main_with_args(int, char**) at l10ntools/source/helpex.cxx:124:17 > #4 in main at l10ntools/source/helpex.cxx:47:1 and > l10ntools/source/xmlparse.cxx:523:44: runtime error: downcast of address 0x6030000007c0 which does not point to an object of type 'XMLParentNode' > 0x6030000007c0: note: object is of type 'XMLData' > 00 00 00 00 e0 53 d5 c0 46 56 00 00 d0 00 00 00 40 60 00 00 f0 07 00 00 30 60 00 00 00 00 00 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'XMLData' > #0 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:523:44 > #1 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:492:80 > #2 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:481:9 > #3 in HelpParser::CreatePO(rtl::OString const&, rtl::OString const&, XMLFile*, std::basic_string_view<char, std::char_traits<char>>) at l10ntools/source/helpmerge.cxx:91:20 > #4 in sal_main_with_args(int, char**) at l10ntools/source/helpex.cxx:124:17 > #5 in main at l10ntools/source/helpex.cxx:47:1 and > l10ntools/source/xmlparse.cxx:526:48: runtime error: downcast of address 0x603000000820 which does not point to an object of type 'XMLParentNode' > 0x603000000820: note: object is of type 'XMLComment' > 00 00 00 00 28 06 92 a9 17 56 00 00 d0 00 00 00 40 60 00 00 40 00 00 00 20 61 00 00 00 00 00 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'XMLComment' > #0 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:523:44 > #1 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:492:80 > #2 in XMLFile::CheckExportStatus(XMLParentNode*) at l10ntools/source/xmlparse.cxx:481:9 > #3 in HelpParser::CreatePO(rtl::OString const&, rtl::OString const&, XMLFile*, std::basic_string_view<char, std::char_traits<char>>) at l10ntools/source/helpmerge.cxx:91:20 > #4 in sal_main_with_args(int, char**) at l10ntools/source/helpex.cxx:124:17 > #5 in main at l10ntools/source/helpex.cxx:47:1 Change-Id: I1e2c6bf802aa03b5b1eb21532e98fa22d966e683 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143000 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-15asan: fix leak in lcl_MergeLevelJulien Nabet
Direct leak of 2000 byte(s) in 2 object(s) allocated from: 0 0x55906afe399e in malloc (/home/julien/lo/libo_perf/workdir/LinkTarget/Executable/treex+0xff99e) (BuildId: 5b19224d0ca2120a) 1 0x7fd51a4abfd7 in xmlEncodeSpecialChars (/lib/x86_64-linux-gnu/libxml2.so.2+0x31fd7) (BuildId: 008b52a46ddf3013589362f7f678f7a6c8dd1e56) 2 0x55906b023403 in (anonymous namespace)::lcl_MergeLevel(_xmlDoc*, _xmlNode*, unsigned char const*, MergeDataFile*, rtl::OString const&, rtl::OString const&) treemerge.cxx 3 0x55906b0232d4 in (anonymous namespace)::lcl_MergeLevel(_xmlDoc*, _xmlNode*, unsigned char const*, MergeDataFile*, rtl::OString const&, rtl::OString const&) treemerge.cxx 4 0x55906b0232d4 in (anonymous namespace)::lcl_MergeLevel(_xmlDoc*, _xmlNode*, unsigned char const*, MergeDataFile*, rtl::OString const&, rtl::OString const&) treemerge.cxx 5 0x55906b0226ef in TreeParser::Merge(rtl::OString const&, rtl::OString const&, rtl::OString const&) treemerge.cxx 6 0x55906b02c0dd in sal_main_with_args(int, char**) treex.cxx 7 0x55906b02baad in main (/home/julien/lo/libo_perf/workdir/LinkTarget/Executable/treex+0x147aad) (BuildId: 5b19224d0ca2120a) 8 0x7fd519e46189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 Change-Id: I9882cd63b91967d9b8998ba25545c11a3168e739 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142717 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-11-08A better fix for C++23 P2266R1Stephan Bergmann
After 6d6a143913603b040c10a5db83c2103557899011 "Address some of the sprintf in vcl/source/fontsubset/cff.cxx", --with-latest-c++ builds that pick up a C++23 compiler that implements <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html> "P2266R1: Simpler implicit move" started to fail with something like > vcl/source/fontsubset/cff.cxx:2061:16: error: no viable conversion from returned value of type 'char[64]' to function return type 'OString' > return aDefaultGlyphName; > ^~~~~~~~~~~~~~~~~ [...] > include/rtl/string.hxx:313:5: note: candidate constructor [with T = char[64]] not viable: expects an lvalue for 1st argument > OString( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() ) > ^ etc. So I figured there should be something better than 433ab39b2175bdadb4916373cd2dc8e1aabc08a5 "Adapt implicit OString return value construction to C++23 P2266R1" (which this commit reverts, modulo its conflicts in comphelper/source/xml/xmltools.cxx and sc/source/filter/xcl97/XclExpChangeTrack.cxx) to address the underlying issue in a way that keeps code that works up to C++20 also working in C++23. (The fix is only relevant for non-explicit constructors that involve NonConstCharArrayDetector and non-const lvalue references, not for other functions involving those. OUString has a similar constructor but which is explicit, and OUStringBuffer doesn't have any similar constructors at all, so this only affects OString and OStringBuffer constructors.) Change-Id: I31cf16b9507899f5999243f8467dfa24bc94c5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142455 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski
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-06-23clang-tidy modernize-pass-by-value in l10ntoolsNoel Grandin
Change-Id: Icf07a0f3784f0f39fa6b141a24aa25fddab71901 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136272 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-05use more o3tl::getTokenNoel Grandin
found by inspecting call sites of OUString::getToken Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-15address potential find/rfind failuresNoel Grandin
in the conversion in commit 74957c7d2f3697fbf2b6f4d6a31c61d5d7df039b Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Apr 13 13:54:22 2022 +0200 use more string_view in l10ntools where the prior code might have been relying on the -1 returned by indexOf and lastIndexOd Change-Id: Ief5dedccbaf4e14e5f59aa3c2f7481ff0bb7e2e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133027 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-13use more string_view in l10ntoolsNoel Grandin
Change-Id: I93958e8e2dc1e172413ff697d6b6be975cff064d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132956 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-12loplugin:stringview more o3tl conversionNoel Grandin
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10loplugin:stringview check for getToken and trimNoel Grandin
since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08loplugin:stringviewparam convert methods using trimNoel Grandin
for which we add a new o3tl::trim method Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-02loplugin:stringviewparam convert methods using indexOfNoel Grandin
.. 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>
2022-02-21Fail Executable_ulfex upon duplicate keys in malformed inputStephan Bergmann
...instead of causing use-after-free of pMergeEntrys, which would be destroyed during the (non-adding) emplace call but would still be used in the following if/else block (see the commit message of c6e2052b6f0d281fed334f8c803b1a6486d5b3bc "Update git submodules: Fix duplicate key typo") Change-Id: Iac8d67e61aba0144d3d5807f478c7b330d7c4c81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130235 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-27Recheck modules [i-l]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I758bb27e93779e3df21c463714e49354748f446f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128715 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-12-22loplugin:flatten in l10ntools..lotuswordproNoel Grandin
Change-Id: Ie6de142db1987094fdf538148ac5ee33379a3e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-26loplugin:stringliteraldefine in l10ntools..ooxNoel Grandin
Change-Id: Ia19d247f3cf439405c05a53c4cf2c9d0e7344560 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-10new loplugin:stringliteraldefineNoel Grandin
look for #define FOO "foo" that can be converted into OUStringLiteral. This is the first pass of this plugin, only doing those #define which are local to a single compilation unit. Change-Id: Ic8610e29ec42c36d03db5014a93c244315d5bbea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124962 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11In O[U]StringBuffer, make string_view params replacements for OUString onesStephan Bergmann
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-04drop 'using namespace std' in l*Julien Nabet
Change-Id: I88909cf813f39a52c70d3cbcb19ff326d9bb42d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123069 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann
...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-09-23Extend loplugin:stringviewparam to starts/endsWith: l10ntoolsStephan Bergmann
Change-Id: I2c8c8e0fb034f79bb844a1d09defc3227324e686 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122494 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-01clang-tidy:readability-redundant-member-initNoel Grandin
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-28loplugin:indentation improve checks for brace alignmentNoel Grandin
Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-18Simplify a OUString constructionStephan Bergmann
Change-Id: Ie7bf010f6864db19b7cc64761b34e203ce70784d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117458 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-16Adapt implicit OString return value construction to C++23 P2266R1Stephan Bergmann
With the recent implementation of <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html> "P2266R1: Simpler implicit move" in Clang 13 trunk as <https://github.com/llvm/llvm-project/commit/bf20631782183cd19e0bb7219e908c2bbb01a75f> "[clang] Implement P2266 Simpler implicit move", a --with-latest-c++ build started to fail with > comphelper/source/xml/xmltools.cxx:103:20: error: no viable conversion from returned value of type 'char [39]' to function return type 'rtl::OString' > return str; > ^~~ [...] > include/rtl/string.hxx:277:5: note: candidate constructor [with T = char [39]] not viable: expects an lvalue for 1st argument > OString( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() ) > ^ [...] etc. Change-Id: If34f143a1855fdd7cd22ea3d7594f9381d50a7ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-03-Werror,-Wunused-but-set-variable (Clang 13 trunk)Stephan Bergmann
sLanguage and sTmpStrVal are unused since c9611c5e6465948de029e9c2fbd17e75ee07d31f "loplugin:unusedfields in l10ntools..sax". Simplify the for loop now that it only checks for a single item, and expand the ID macro at its last remaining use. Change-Id: I3cf6692fc5a4efd58d0df1dbc24b3610916b2fd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116665 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-28no need to allocate these on the heapNoel Grandin
Change-Id: Ic1a1577ed837d3fa2b7b99474f4cee30300628f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116290 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-19use more string_view in OString APINoel Grandin
some parts of the OString seem to have fallen behind its more popular sibling OUString. Change-Id: Ie6d64c3005b2df5da49ba79d0c38282dd5057a23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-30HelpParser::ProcessHelp: Tidy Null checksDr. David Alan Gilbert
cppcheck spotted a repeated nullptr pair of if's near the start that can be squashed. Those gurantee that later pXMLElement is non-null, so we don't need the test later. Change-Id: Ie8fc24490ef031416709d55e6fbdd99e9853c4f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-29loplugin:stringviewparam extend to new..Noel
O[U]StringBuffer methods Change-Id: I0ffbc33d54ae7c98b5652434f3370ee4f819f6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110090 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-28add string_view variants of methods to O[U]StringBufferNoel
and update the stringview loplugin to detect cases where we can use these new methods. Change-Id: I998efe02e35c8efcb3abfb4d7186165bbe6dfb2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110046 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-27pocheck: don't require reference for stock labelsChristian Lohmaier
See d5d905b480c2a9b1db982f2867e87b5c230d1ab9 and related commits for the rationale on why those are not extracted like other strings. Change-Id: I2a339747626e0fb314cac7f57bccb2b91853249c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109916 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-01-15prep to replace stock button labelsCaolán McNamara
a) as per https://developer.gnome.org/gtk3/stable/gtk3-Stock-Items.html use-stock=gtk-ok is deprecated and plain "OK", "Cancel" are indicated instead. b) to avoid adding thousands of extra labels to translate we'll convert use-stock buttons to use the translatable strings, but give them all the same "stock" translation context. Our translation rules don't like duplicates in the output .po's so strip "stock" contents from the translation collection rules in uiex and add a single set per .po in l10ntools/source/localize.cxx c) a script to rewrite the .uis to the new rules the previously use-stock labels won't appear translated until there has been a round trip of extraction, translations and import of translations Change-Id: Ibe4d0d27f2abbf5aa3df9c63af1561cd01d9fddd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108812 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-27Simplify loplugin:stringviewparam comparison operator handlingStephan Bergmann
In practice, it works fine to look at all of them, regardless of actual argument types. Change-Id: Ifc49cbcd6003c8837c1b3f81d432c59fb0657bf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108366 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...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-12-09Apparently, Windows doesn't have the concept of a set but empty env varStephan Bergmann
...so in an (implicitly) --disable-release-build build (where config_host.mk contains a export ENABLE_RELEASE_BUILD= line), getenv("ENABLE_RELEASE_BUILD") returns null, and after a5484e496dcee9b110ef696101576a14b7a5a20e "Assert that certain env vars are set in these build-time tools" e.g. `make CustomTarget_librelogo/locproperties` started to fail with > [build PRP] CustomTarget/librelogo/locproperties/LibreLogo_de.properties > S=C:/lo/core && I=$S/instdir && W=$S/workdir && MERGEINPUT=C:/cygwin64/tmp/gbuild.iDa6ga && PATH="C:\lo\core\instdir\program;C:\lo\core\instdir\program;$PATH" $W/LinkTarget/Executable/propex.exe -i $S/librelogo/source/pythonpath/LibreLogo_en_US.properties -o $W/CustomTarget/librelogo/locproperties/LibreLogo_de.properties -m ${MERGEINPUT} -l de && rm -rf ${MERGEINPUT} > Assertion failed: env != nullptr, file C:/lo/core/l10ntools/source/merge.cxx, line 117 > make[1]: *** [C:/lo/core/librelogo/CustomTarget_librelogo.mk:38: C:/lo/core/workdir/CustomTarget/librelogo/locproperties/LibreLogo_de.properties] Error 3 The other asserts added with a5484e496dcee9b110ef696101576a14b7a5a20e should be OK, though: * SRC_ROOT should never be empty. * WORKDIR_FOR_BUILD could presumably be empty in a cross-compilation build ($cross_compile = yes in configure.ac), but the code in l10ntools/source/localize.cxx apparently expects WORKDIR_FOR_BUILD not to be empty anyway. (And at least in a nominally cross-compilation build with --host=i686-pc-cygwin on Windows x64, $cross-compile is left empty in configure.ac and WORKDIR_FOR_BUILD is set to a non-empty value.) * ALL_LANGS should never be empty given how it is set in configure.ac, even if the code in l10ntools/source/pocheck.cxx contains an explicit if( aLanguages.isEmpty() ) check. Change-Id: I06b216587f5d76e4b5d5abc748ff34308f2e9dbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107462 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-12-08Assert that certain env vars are set in these build-time toolsStephan Bergmann
All of those env vars are exported from config_host.mk or config_host_lang.mk. The asserts guard potential future changes from using OString to using std::string_view, where OString has an undocumented feature of allowing construction from a null pointer. Change-Id: I7bb2217fb1d38300bf169b17e9e72dafc6970b2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107414 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-08Use OString::Concat(...) + ... instead of ... + OStringLiteral(...)Stephan Bergmann
...in some places Change-Id: Ia1d6135c89bcc18d436d8c0d353ca93195dda432 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107412 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-16Clean up --disable-assert-always-abort loplugin:stringviewparamStephan Bergmann
(457d76327a57303124804a201d58b52ba23ccefe "loplugin:stringviewparam (l10ntools)") Change-Id: Iebe0f61de4fd4d4744b47d17d8e3ff3f80217d18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105929 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-14loplugin:stringviewparam (l10ntools)Julien Nabet
Change-Id: I9102a00e19af87de4f666d1759551be3af311fe0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105828 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-11-13tdf#123936 Formatting files in module l10ntools with clang-formatPhilipp Hofer
Change-Id: I5f8c2aec02e160a22e9ff484170303927f0c9c05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105686 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-11loplugin:stringviewNoel
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-11disable O(U)String::concat for internal codeNoel Grandin
in favour of the more widely used, and better optimised, operator+ Change-Id: I6a1b37e0f3d253af1f7a0892443f59b620efea63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105523 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>