summaryrefslogtreecommitdiff
path: root/package
AgeCommit message (Collapse)AuthorFilesLines
2019-04-19optimise find/insert patternNoel Grandin1-2/+1
if we're doing a find/insert on a set or a map, it is better to just do a conditional insert/emplace operation than triggering two lookups. Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d Reviewed-on: https://gerrit.libreoffice.org/70937 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-13loplugin:sequentialassign in oox..reportdesignNoel Grandin4-18/+6
Change-Id: I59ef0a6da411b8af8bdf8d8efb1d733db7475d9c Reviewed-on: https://gerrit.libreoffice.org/70707 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-09Fix typosAndrea Gelmini1-3/+3
Change-Id: Idc6d5fcc91f74d1450ef44634274651074f768c0 Reviewed-on: https://gerrit.libreoffice.org/70437 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
2019-04-08tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 5Noel Grandin2-80/+96
Individually, these don't make much difference, but they add up to a halving the time to save on my machine. OStorageImpl is spending time iterating over its m_aChildrenVector to find stuff by name, so just use a std::unordered_map. Also return iterator from FindElement, so we can avoid searching the map twice. This was probably the biggest win. Change-Id: I30776bad5377d14144fc7a47e86527e2cdb62a83 Reviewed-on: https://gerrit.libreoffice.org/70313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-08tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 3Noel Grandin2-5/+6
Individually, these don't make much difference, but they add up to a halving the time to save on my machine. ManifestImport::characters was spending time adding data to an OUString, so convert that to an OUStringBuffer. Change-Id: I267e701f4e7998044763f44199b1fe8a37325b68 Reviewed-on: https://gerrit.libreoffice.org/70311 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-08Use osl_atomic_increment/osl_atomic_decrement to change m_refCountMike Kaganski4-4/+5
Change-Id: Ia24441d3671102fdeeb797547396c25ee2a6ffd3 Reviewed-on: https://gerrit.libreoffice.org/70382 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-04-07Don't use resettable/clearable guard where plain guard is enoughMike Kaganski4-308/+328
Also use scope where possible. This allows to limit guard scope at language level; visualises the scope clearly; and helps avoiding errors like fixed in commit 61e4437c857854b331fa01da6f39b2b3b58a800b. Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41 Reviewed-on: https://gerrit.libreoffice.org/70376 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-03-31tdf#120703 PVS: remove redundant static castsMike Kaganski2-15/+9
V572 It is odd that the object which was created using 'new' operator is immediately cast to another type. Change-Id: I54976062dc3f62eaaa79f89eff54454f0b24ac2c Reviewed-on: https://gerrit.libreoffice.org/69989 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-03-28return unique_ptr from CreateNewStorageImplNoel Grandin2-6/+6
Change-Id: I32fa9b9bf4067792a3ad968ba5f2ef9b311ef48a Reviewed-on: https://gerrit.libreoffice.org/69858 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-17tdf#120703 PVS: remove redundant static castsMike Kaganski1-1/+1
V572 It is odd that the object which was created using 'new' operator is immediately cast to another type. Change-Id: I6d1523e71b3e06be1cf41abaabb44e49fe11cd8e Reviewed-on: https://gerrit.libreoffice.org/69369 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-03-03Remove redundant bitwise and when converting from sal_uInt32 to sal_Int32Stephan Bergmann1-1/+1
...which has no effect on the result, but silences benign Clang -fsanitize=implicit-signed-integer-truncation warnings Change-Id: I0953914a35f2a8c4caa6f75d4918e3b3366d07e8 Reviewed-on: https://gerrit.libreoffice.org/68628 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-19pretty up logging of exceptionsNoel Grandin3-128/+131
Add exceptionToString() and getCaughtExceptionAsString() methods in tools. Use the new methods in DbgUnhandledException() Add special-case case code for most of the exceptions that contain extra fields, so all of the relevant data ends up in the log Change-Id: I376f6549b4d7bd480202f8bff17a454657c75ece Reviewed-on: https://gerrit.libreoffice.org/67857 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-15Simplify containers iterations in oox, opencl, packageArkadiy Illarionov7-182/+136
Use range-based loop or replace with STL functions Change-Id: I91405920d91383bc6cf13b9497d262b1f6f0a84d Reviewed-on: https://gerrit.libreoffice.org/67848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-11tdf#120703 PVS: V560 A part of conditional expression is always true/falseMike Kaganski1-49/+43
Change-Id: Ib9ad5b874a210ef3862c668158fcc5d18eeab363 Reviewed-on: https://gerrit.libreoffice.org/67579 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-02-09loplugin:indentation in oox..packageNoel Grandin6-20/+20
Change-Id: Ie50a1ad6e27786ccdaae2ba1ae96f5682c4a38f6 Reviewed-on: https://gerrit.libreoffice.org/67560 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-22o3tl::make_unique -> std::make_unique in i18npool...reportdesignGabor Kelemen7-16/+8
Since it is now possible to use C++14, it's time to replace the temporary solution with the standard one Change-Id: I8bee1344f7df82536f31bc5e4ec4fd379cac1d04 Reviewed-on: https://gerrit.libreoffice.org/66704 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-08Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann2-2/+2
...after 7ffdd830d5fb52f2ca25aa80277d22ea6d89970b "HAVE_CPP_ATTRIBUTE_FALLTHROUGH is always true now" Change-Id: I54e5ff4e036a6bb3e5774d1c0524158aae18e937 Reviewed-on: https://gerrit.libreoffice.org/64800 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-05loplugin:unnecessaryparen include more assignmentsNoel Grandin1-3/+3
Change-Id: I9fb8366634b31230b732dd38a98f800075529714 Reviewed-on: https://gerrit.libreoffice.org/64510 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-29remove unnecessary "if (!empty()" checks before loopsNoel Grandin1-10/+7
found with git grep -n -A4 'if.*!.*empty' | grep -B3 -P '(\bfor)|(\bwhile)|(\bdo)' Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334 Reviewed-on: https://gerrit.libreoffice.org/64169 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-24Use returned iterator by list::eraseJulien Nabet1-3/+8
Change-Id: I42312f5cbd0de65cc8915e6833eff668d244f66b Reviewed-on: https://gerrit.libreoffice.org/63956 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-11-16loplugin:staticmethods improvementNoel Grandin2-27/+7
Change-Id: I8889ce8a7d2309b54454cfe4c6421282e1c6e755 Reviewed-on: https://gerrit.libreoffice.org/63434 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-12Fix typosAndrea Gelmini1-1/+1
Change-Id: Ibb94b2b16afbcca84dd55ae51fde6fd27afede3a Reviewed-on: https://gerrit.libreoffice.org/63297 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-11-07loplugin:collapseif in framework..salNoel Grandin1-6/+3
Change-Id: I3068b18f5cff024a48a8f8c68d69cadad30fe4d5 Reviewed-on: https://gerrit.libreoffice.org/62953 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-05replace double-checked locking patterns with thread safe local staticsMike Kaganski1-16/+3
Change-Id: I4ed97cc6d9f733292156d71551d5ce3af6071445 Reviewed-on: https://gerrit.libreoffice.org/62858 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-03tdf#120703 PVS: V547 Expression is always true/falseMike Kaganski1-2/+0
Change-Id: I856345576ff5c10a41509a97ad4539272bd55568 Reviewed-on: https://gerrit.libreoffice.org/62803 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-31Translate German commentsJohnny_M1-1/+1
Change-Id: I94cdb753d01dfd0d5b8f78ede1819b281b840ab2 Reviewed-on: https://gerrit.libreoffice.org/62669 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2018-10-19clang-tidy readability-container-size-emptyNoel Grandin3-4/+4
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422 Reviewed-on: https://gerrit.libreoffice.org/61967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19clang-tidy readability-misleading-indentationNoel Grandin2-2/+2
Change-Id: I4673fc7c694924b41d048a1918ddb8b0e0af1f79 Reviewed-on: https://gerrit.libreoffice.org/61935 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-18Fix typo in codeAndrea Gelmini3-5/+5
It passed "make check" on Linux Change-Id: I20e2ecce45ead161a3f95b511416044af4e04290 Reviewed-on: https://gerrit.libreoffice.org/61917 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-10-17clang-tidy readability-redundant-smartptr-getNoel Grandin1-2/+2
redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15clang-tidy misc-redundant-expressionNoel Grandin1-2/+2
Change-Id: I708b0b486a233071f95592ccdb97f27fc35a23c4 Reviewed-on: https://gerrit.libreoffice.org/61783 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-13loplugin:constfields in package..registryNoel Grandin14-24/+24
Change-Id: Ie139490f2b008bf294910d002af711f8f41fe76d Reviewed-on: https://gerrit.libreoffice.org/61727 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-24tdf#42949 Fix IWYU warnings in include/comphelper/[a-l]*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I22ba2c8aec235e34cd7835b8a0a716bf3057db7a Reviewed-on: https://gerrit.libreoffice.org/60837 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann5-5/+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-13tdf#42949 Fix IWYU warnings in include/ucbhelper/*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I7bfeef47abaf94cfb355db95c0fdb928ce36c0a6 Reviewed-on: https://gerrit.libreoffice.org/60232 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-11Revert "clang bugprone-unused-return-value"Noel Grandin1-3/+5
comment from sberg: aren't these changes broken in general, when the called function may throw an exception before it takes ownership of the passed-in pointer? So revert, except for (a) PlainTextFilterDetect::detect, which was definitely a leak (b) SwCursor::FindAll, where unique_ptr was being unnecessarily used This reverts commit 7764ae70b04058a64a3999529e98d1115ba59d1c. Change-Id: I555e651b44e245b031729013d2ce88d26e8a357e Reviewed-on: https://gerrit.libreoffice.org/60301 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-09-09loplugin:simplifyconstruct in l10ntools..packageNoel Grandin5-11/+3
Change-Id: I8dba8ef1e7455af1e55bbd6086b49c0606bf4927 Reviewed-on: https://gerrit.libreoffice.org/60212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-08clang-tidy bugprone-unused-return-valueNoel Grandin1-6/+0
In OStorage::openEncryptedStream the lines were marked with a TODO until the TODO comment was removed in commit 8083b46285fefc4af751e1b00d20b40bea196ea8 Date: Tue Jun 16 16:15:54 2009 +0000 CWS-TOOLING: integrate CWS fwk103 Since no-one has "fixed" this intended functionality by now, I just removed it. The lines in unoidl/ were introduced by commit 12353c73868d26690aa4ac008ef5e9f2db8bc12c Date: Fri Mar 1 23:23:50 2013 +0100 WIP: Experimental new binary type.rdb format I assume that not throwing these was just an oversight. Change-Id: I26fbcce267f2cc1154a30b8259176f59611dfbd8 Reviewed-on: https://gerrit.libreoffice.org/60161 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-08clang bugprone-unused-return-valueNoel Grandin1-5/+3
most of these changes just make the change of ownership when using std::unique_ptr clearer, but there is one definite leak fix in PlainTextFilterDetect::detect Change-Id: I8282a68007222a4fee84004f394bde0cca8569e9 Reviewed-on: https://gerrit.libreoffice.org/60159 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29Fix typosAndrea Gelmini4-10/+10
Change-Id: I6ca53ead2b125618d0aceff05d5fdfa374662799 Reviewed-on: https://gerrit.libreoffice.org/58809 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-08-29loplugin:constantparam (2)Noel Grandin2-4/+4
Change-Id: I528f22876497f87159e3b9453362ebbfb55b7092
2018-08-23Related rhbz#1618703: Properly handle failure encoding zip fileStephan Bergmann1-41/+34
...when e.g. FIPS mode makes ZipFile::StaticGetCipher fail by throwing an exception which would be caught by ZipPackageStream::saveChild (in package/source/zippackage/ZipPackageStream.cxx) alright (and translated into bSuccess = false), if ZipFile::StaticGetCipher didn't unhelpfully swallow and ignore all exceptions in an outer try-catch. Change-Id: I14376128515df1dd4bdac921edd8ab94cc9b7617 Reviewed-on: https://gerrit.libreoffice.org/59514 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-22new loplugin:conststringfieldNoel Grandin2-215/+145
Look for const string fields which can be static, and mostly convert them to OUStringLiteral And add a getLength() method to OUStringLiteral to make the transition easier. Remove dead code in XclExpRoot::GenerateDefaultEncryptionData, default password is never empty. Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091 Reviewed-on: https://gerrit.libreoffice.org/59204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-15loplugin:useuniqueptr in consumeScheduledThreadEntryNoel Grandin2-9/+7
Change-Id: I9c0b05081915712089d363a476d6354cfba2461d Reviewed-on: https://gerrit.libreoffice.org/59010 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-13Fix typosAndrea Gelmini1-1/+1
Change-Id: Ie3baa2f843a98c1edc523050db53beaa2c803394 Reviewed-on: https://gerrit.libreoffice.org/58801 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-08-13loplugin:returnconstant in oox,packageNoel Grandin2-4/+2
Change-Id: I1dade7ddde6b1e226861d32f24f65be5bb9d9352 Reviewed-on: https://gerrit.libreoffice.org/58880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-04use C++11 exception rethrowingCaolán McNamara6-14/+13
for those cases where we are doing relatively simple catching and rethrowing e.g. catch in one thread and throw in main thread. Change-Id: I6192017c4ec99dd671a9582f7b004096b0fc4525 Reviewed-on: https://gerrit.libreoffice.org/58588 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-07-31ofz#9597 rethrown IOException not caught by catch IOExceptionCaolán McNamara2-5/+5
under google oss-fuzz, asan + clang version 6.0.0 (trunk 315613) when using our own exception thrower, but builtin C++11 support works also, ofz#9266, ofz#9591, ofz#9597, ofz#9622, etc Change-Id: I29c692da880b49268284de2f61be07fa94f33bc6 Reviewed-on: https://gerrit.libreoffice.org/58223 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-30Add missing sal/log.hxx headersGabor Kelemen20-0/+20
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>