summaryrefslogtreecommitdiff
path: root/comphelper
AgeCommit message (Collapse)AuthorFilesLines
2020-09-22OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaroundCaolán McNamara4-22/+22
do more like commit 121771e37f7e2de41cd5643475861062bf25627b Date: Mon Sep 21 09:17:54 2020 +0200 Make some OUStringLiteral vars constexpr cause coverity can live with that Change-Id: I9efd7f848289c4865997a44c6780373068422227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-16Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uStringStephan Bergmann1-1/+2
...from which an OUString can cheaply be instantiated. This is the OUString equivalent of 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String". Most remarks about that commit apply here too (this commit is just substantially bigger and a bit more complicated because there were so much more uses of OUStringLiteral than of OStringLiteral): The one downside is that OUStringLiteral now needs to be a template abstracting over the string length. But any uses for which that is a problem (e.g., as the element type of a container that would no longer be homogeneous, or in the signature of a function that shall not be turned into a template for one reason or another) can be replaced with std::u16string_view, without loss of efficiency compared to the original OUStringLiteral, and without loss of expressivity. The new OUStringLiteral ctor code would probably not be very efficient if it were ever executed at runtime, but it is intended to be only executed at compile time. Where available, C++20 "consteval" is used to statically ensure that. The intended use of the new OUStringLiteral is in all cases where an object that shall itself not be an OUString (e.g., because it shall be a global static variable for which the OUString ctor/dtor would be detrimental at library load/unload) must be converted to an OUString instance in at least one place. Other string literal abstractions could use std::u16string_view (or just plain char16_t const[N]), but interestingly OUStringLiteral might be more efficient than constexpr std::u16string_view even for such cases, as it should not need any relocations at library load time. For now, no existing uses of OUStringLiteral have been changed to some other abstraction (unless technically necessary as discussed above), and no additional places that would benefit from OUStringLiteral have been changed to use it. Global constexpr OUStringLiteral variables defined in an included file would be somewhat suboptimal, as each translation unit that uses them would create its own, unshared instance. The envisioned solution is to turn them into static data members of some class (and there may be a loplugin coming to find and fix affected places). Another approach that has been taken here in a few cases where such variables were only used in one .cxx anyway is to move their definitions from the .hxx into that one .cxx (in turn causing some files to become empty and get removed completely)---which also silenced some GCC -Werror=unused-variable if a variable from a .hxx was not used in some .cxx including it. To keep individual commits reasonably manageable, some consumers of OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat odd state for now, where they don't take advantage of OUStringLiteral's equivalence to rtl_uString, but just keep extracting its contents and copy it elsewhere. In follow-up commits, those consumers should be changed appropriately, making them treat OUStringLiteral like an rtl_uString or dropping the OUStringLiteral overload in favor of an existing (and cheap to use now) OUString overload, etc. In a similar vein, comparison operators between OUString and std::u16string_view have been added to the existing plethora of comparison operator overloads. It would be nice to eventually consolidate them, esp. with the overloads taking OUStringLiteral and/or char16_t const[N] string literals, but that appears tricky to get right without introducing new ambiguities. Also, a handful of places across the code base use comparisons between OUString and OUStringNumber, which are now ambiguous (converting the OUStringNumber to either OUString or std::u16string_view). For simplicity, those few places have manually been fixed for now by adding explicit conversion to std::u16string_view. Also some compilerplugins code needed to be adapted, and some of the compilerplugins/test cases have become irrelevant (and have been removed), as the tested code would no longer compile in the first place. sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template argument deduction in unevaluated, parenthesized context". That place, as well as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and i18npool/source/localedata/localedata.cxx, which have been replaced with OUString::Concat (and which is arguably a better choice, anyway), also caused failures with at least Clang 5.0.2 (but would not have caused failures with at least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile been fixed). Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-11small optimisationNoel Grandin1-4/+60
avoid allocating predicate on heap, which is expensive when walking over large numbers of styles nodes Change-Id: Ida4369b77fb74f3af1258a97b0b99e3a78413833 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-04tdf#124176 Use #pragma once in comphelperGeorge Bateman4-16/+4
This commit was carried out by a Python script, source of which is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97. Change-Id: I72229dc1ef743f0394f778aec7c49c11fe7e5176 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100183 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-31Fix typo in codeAndrea Gelmini1-2/+2
It passed "make check on Linux" Change-Id: I53b40e36c6b1c0aa115044208b5a372fb101347b
2020-08-28Simply use OUString aPassword as-isStephan Bergmann1-1/+1
...instead of creating a copy via the OUString(sal_Unicode const *) ctor. (This was introduced with dd198398b6e5c84ab1255a90ef96e6445b66a64f, but for no obvious reason.) Change-Id: I9b46b3b1bb402c11810a4d3e68592cfe6fd8034c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101568 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann6-25/+25
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-26[API CHANGE] Drop OSL_THIS_FUNC, directly use C++11 __func__Stephan Bergmann2-2/+2
It had been documented as "the macro OSL_THIS_FUNC is intended to be an office internal macro for now", so take the liberty of removing it, even if technically that can be considered an incompatible API change. Change-Id: I7580a932e1da54845934378a650e894f3f3a9062 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101406 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-24NullToPointer ValueDependentIsNotNull GNUNull -> nullptr [loplugin:nullptr]Caolán McNamara1-1/+1
Change-Id: I93efe23af18c622123ddc3feb41a43a485ee2722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101285 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-14loplugin:simplifybool moreNoel Grandin1-2/+2
look for expressions like !(a && !b) which can be expanded out Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-13loplugin:stringstatic also look for local staticsNoel Grandin2-20/+20
Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-12SvTreeListBox can move into toolkit headers nowCaolán McNamara1-3/+1
Change-Id: I6b3b6ef1530a192f4b6bf87aa9688687063683ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100591 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-31loplugin:unusedmethodsNoel Grandin2-60/+0
Change-Id: I0d888b565b0b53b318b790926667d7ba49504411 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99854 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-30loplugin:unusedmethodsNoel Grandin1-13/+0
and tweak the plugin a little to speed it up Change-Id: Ia59456232602184c4f1b5d1d75ad94a9a2e2d0be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99799 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-30svx: GalleryObjectCollection shared class and related refactoring workAditya1-0/+48
Add GalleryObjectCollection, a shared class primarily owned by GalleryTheme which contains object list to be used by GalleryTheme and GalleryBinaryEngine. Refactor ImplCreateUniqueURL, InsertGraphic() Implement comphelper::GraphicMimeTypeHelper::GetExtensionForConvertDataFormat() Refactor Actualize(), implement updateSvDrawObject(), updateTheme() Move ImplCreateSvDrawStorage into constructor instead of calling in directly. Change-Id: I6a8c552268628b4e192f45112ac9e8789c6e1609 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99035 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-07-25loplugin:unusedmethodsNoel Grandin1-32/+0
Change-Id: I3a35c988b1c55b16958172ed5ef4e2d5cb410e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99413 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-22tdf#81522 comphelper: just ignore disposed obj on saveJustin Luth1-66/+73
Even if xObj.is(), it might be disposed, and then getCurrentState() will raise an exception, resulting in an ERRCODE_IO_GENERAL, and failing to save the entire document. Although it might not seem good to just ignore an error on save, the general attitude in that function already leans that way. In fact, the other ::StoreChildren() wraps the entire for-loop in a try-catch. Also, in this function a bad xPersist also breaks out of the loop and returns a false. So wrapping the entire xObj in an "ignore if errors" try-catch seems reasonable to me in this instance. The alternative is not to allow the user to save at all, which is much worse, especially since there is nothing he can do to fix the problem. Change-Id: I0372245563735ae7ac7976bf7ce6060e57a5eb87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99129 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-07-21loplugin:unusedmethodsNoel Grandin4-105/+1
Change-Id: I3520c2e97bb5b1611dcce77ca9f8393b29e75a1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99110 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-16loplugin:unusedmethodsNoel Grandin2-20/+0
Change-Id: Ibc1ec64cba8eb083aaff28848a42337cc597ea19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98857 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-15comphelper: don't hardcode hash sizes in Hash::getLength()Miklos Vajna1-4/+4
Instead move the constants from filter to comphelper and reuse them. Change-Id: Ib7061e9028ccf6067b4e86f50145c1472c2b01d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98785 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-12update pchesCaolán McNamara1-1/+2
Change-Id: I75602277a5a26b012a12f2c4f4b7ff5bb663b0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98474 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-10replace usage of blacklist with excludelist for IWYUThorsten Behrens1-1/+1
Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-10replace usage of whitelist with allowlistThorsten Behrens1-11/+11
Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 [API CHANGE] officecfg::Office::Common::Misc::OpenCLWhiteList -> OpenCLAllowList Change-Id: I65636b19b13e4af1e4851f70e78053f3443d6bb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98181 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-05comphelper: create instances with uno constructorsNoel Grandin5-126/+11
See tdf#74608 for motivation Change-Id: Ib7aa69cdf62992cea38a60aac9169c2f1779c1cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98094 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-30Upcoming improved loplugin:staticanonymous -> redundantstatic: comphelperStephan Bergmann8-25/+25
Change-Id: I222ea673a44528cb04847a912cd8da971bb1be3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97542 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-24use more std::container::insert instead of std::copyNoel Grandin1-10/+2
which is both more compact code, and more efficient, since the insert method can do smarter resizing Change-Id: I17f226660f87cdf002edccc29b4af8fd59a25f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96948 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-03loplugin:simplifypointertobool improveNoel Grandin1-4/+4
to look for the x.get() != null pattern, which can be simplified to x I'll do the x.get() == nullptr pattern in a separate patch, to reduce the chances of a mistake Change-Id: I45e0d178e75359857cdf50d712039cb526016555 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95354 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-03Upcoming loplugin:elidestringvar: comphelperStephan Bergmann6-31/+15
Change-Id: Id388af90ca2c3dff435a1a6261e3de0c3c0dbdbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95376 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-29use for-range loop on SequenceNoel Grandin7-74/+61
Change-Id: Ib2d7b21e0fa52087027c0b3b1d362693c7019ba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93856 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-29improve pahole script and pack a few classesNoel Grandin1-2/+2
(*) fix: I was substracting the padding space instead of adding it when calculating how much free space we had to improve. (*) sort input data, so we process structs located in the same DSO together, which reduces GDB's memory usage (*) handle another error condition, where gdbs output is sufficiently mixed up that we miss the end of commands terminator Change-Id: Ic4bb92b736f38a2b3d90e4a14485152b7f869b43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95041 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-28loplugin:simplifybool in canvas..cuiNoel Grandin1-1/+1
Change-Id: Ib7c3b381ce4456e3d48538ee6f762ceaf2784fe1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94973 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-15replace hard-coded "1.2" ODF version stringsMichael Stahl1-2/+3
Most of these are calls to DocumentDigitalSignatures::createWithVersion(), where it doesn't make a difference if "1.2" or "1.3" is passed in but maybe it will be different with "1.4". There is another ctor createDefault() which looks appropriate for non-ODF contexts and can also be used when no actual signing or verifying is done. In cases where there's an actual document its Storage has the version. Change-Id: Id636bbf965d9f96c7ed5f50774c509032525b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93091 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-05-10new loplugin:simplifypointertoboolNoel Grandin1-1/+1
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-10lok: set device form factor of the client on view creationMarco Cecchetti1-36/+0
This patch allows the lok core to know about the device form facor of the client requesting the creation of new view, immediately instead of a later time. When a new view is needed a "DeviceFormFactor" parameter is forwarded to lo_documentLoadWithOptions and doc_createViewWithOptions from the client. This parameter can have one of the following values: 'desktop', 'tablet','mobile' and it is used to set a global variable accessible by SfxLokHelper::setDeviceFormFactor and SfxLokHelper::getDeviceFormFactor. This global variable is retrived in the SfxViewShell constructor for setting SfxViewShell::maLOKDeviceFormFactor attribute. In SfxViewShell we have the following 3 methods: - bool isLOKDesktop() - bool isLOKTablet() - bool isLOKMobilePhone() which replace the following boolean functions: - comphelper::LibreOfficeKit::isTablet - comphelper::LibreOfficeKit::::isMobilePhone Change-Id: I9b36f354278df8c216fcb90f6a9da8256ec9c1e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93340 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-05-08improve loplugin:referencecastingNoel Grandin1-1/+1
to catch a few more cases Change-Id: I0323fba51bb2b4ba255e1db5aa0d890c5c6a2e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93726 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-08compact namespace in canvas..cuiNoel Grandin1-2/+2
Change-Id: I7bd0c2a55b936896fcfe7e1a374871008a18618f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-06allow disabling Skia's Vulkan use in safe mode (tdf#132439)Luboš Luňák1-0/+5
Change-Id: I2991ace387356f049fba1a730041bbb4c62c876c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93562 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-05-04fix leak in comphelper::TestHashNoel Grandin2-0/+19
by shutting down NSS at end of test Change-Id: I63694e9bc54e8c142592005be353af7ed95d444d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93427 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-29tdf#131733 Show only CN part of X.509 subject infoGabor Kelemen1-14/+5
The problem was that the whole Subject info was returned from X.509 certs if they did not start with one of "CN", "OU", "O", "E" Instead of extending this list with random keys, pass the type of cert and only return the whole Subject info if it's an OpenGPG one, and process the info unconditionally if it's X.509 like before the OpenGPG integration Change-Id: I1aa5d7285e48b0f4a769a073cdfb7732e482792c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92675 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann2-1/+4
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-26update pchesCaolán McNamara1-2/+2
Change-Id: I83a61da7dda6c72552eecd377f1c3744c92a797e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92909 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-22uiobject.hxx only needs forward declaresCaolán McNamara1-2/+3
and update pches accordingly Change-Id: I411712532fd85961bffe6678416fcdc1d9c7f53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92617 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-18loplugin:flatten in comphelperNoel Grandin16-507/+508
Change-Id: I1a8db4dbd744b87406d1db5609585495f01f4403 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-14loplugin:buriedassign in c*Noel Grandin1-3/+6
Change-Id: Id14fed7e5c0f588ad3c927f12251432d12c1a7c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-26Check call to NSS_NoDB_Init for successStephan Bergmann1-1/+7
I had run into this when prior to 23245f723fb29262b8543d6447d1b0bb69cb50fb "external/nss: Fix rpath for Linux et al" that call had failed at least for my Linux ASan+UBSan build, causing UITest_calc_tests to fail with > ../../lib/cryptohi/sechash.c:443:16: runtime error: member access within null pointer of type 'HASHContext' (aka 'struct HASHContextStr') > #0 in HASH_Begin at workdir/UnpackedTarball/nss/nss/out/Debug/../../lib/cryptohi/sechash.c:443:16 (instdir/program/libnss3.so +0x3c47eb) > #1 in comphelper::HashImpl::HashImpl(comphelper::HashType) at comphelper/source/misc/hash.cxx:78:9 (instdir/program/libcomphelper.so +0x149945a) > #2 in comphelper::Hash::Hash(comphelper::HashType) at comphelper/source/misc/hash.cxx:96:16 (instdir/program/libcomphelper.so +0x1496eb7) > #3 in vcl::PDFWriterImpl::PDFWriterImpl(vcl::PDFWriter::PDFWriterContext const&, com::sun::star::uno::Reference<com::sun::star::beans::XMaterialHolder> const&, vcl::PDFWriter&) at vcl/source/gdi/pdfwriter_impl.cxx:1137:9 (instdir/program/libvcllo.so +0x8f20d3c) because that HASH functionality was used even though initializing it had failed. Throwing a RuntimeException appears to be effective, even though conceptually not the best approach: at least doing "Export Directly as PDF" of a fresh Writer document fails cleanly with an error box "Error saving the document Untitled 1: General Error. General input/output error." Change-Id: I07564a7f27a7b44e535556032e0eeb267026f06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91088 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-03-24Simplify the LibreOfficeKit mobile phone and tablet APITor Lillqvist1-4/+8
There is not need to ever change the kind of device a view is for, so why bother with the bool parameter to setMobilePhone() and setTablet(). Also, make sure just either of them is called, at most once, for a view. Change-Id: I9ac872f0ab4772e4a7c40c49f62b32fa7b1e47f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90968 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-03-20Rename isMobile to isMobilePhone and introduce a separate isTabletTor Lillqvist1-9/+22
The intended semantics of isMobile() has been to say whether the device is a mobile phone ot not. Not whether it is a mobile device in general. So make that explicit. Adjust call sites as necessary. Also, in a couple of places where it is likely that what is relevant is whether it is a mobile device in general, not just whether it is a mobile phone, check both isMobile() and isTablet(). For stable interoperability with current Online, keep accepting also the .uno:LOKSetMobile "command" (and .uno:LOKUnSetMobile, except that Online never sends that). Online will eventually be changed to use .uno:LOKSetMobilePhone or .uno:LOGSetTablet only (and never the UnSet variants). Also drop the default value for the bool parameter to setMobilePhone(). Default bool parameters can be quite confusing, and it was especially silly in this case as there is one (1) call site. This is a work in progress and will be improved. Currently there are undefined corner cases. Change-Id: I2a71c37323ee151cbc671bd8e714e1dee10f8b1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90560 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90778 Tested-by: Jenkins
2020-03-18comphelper::isDebuggerAttached must be defined irrespective of NDEBUGStephan Bergmann1-1/+1
ac9083f64fc064e4bad3dc522a90ca214b3f1c2f "make isDebuggerAttached() public comphelper API" had forgotten to drop the NDEBUG condition, causing --enable-dbgutil --disable-assert-always-abort builds like <https://ci.libreoffice.org//job/lo_tb_random_config_linux/2215/> to fail with > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/workdir/CxxObject/vcl/source/app/watchdog.o: in function `WatchdogThread::start()': > /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/vcl/source/app/watchdog.cxx:138: undefined reference to `comphelper::isDebuggerAttached()' > collect2: error: ld returned 1 exit status > /lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/vcl/Library_vcl.mk:20: recipe for target '/lo/home/tdf/lode/jenkins/workspace/lo_tb_random_config_linux/instdir/program/libvcllo.so' failed Change-Id: Ia391881f0b6a79709fbebfd204097840a9890147 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90698 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-03-14tdf#130975 replace `rtl::math::isNan` with `std::isnan`.Yukio Siraichi1-1/+1
Change-Id: I5d53e6369d35093445b2efd8936bbf8c6775ff47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90451 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-03-04comphelper: allow simple ad-hoc measuring with ProfileZonesMiklos Vajna1-0/+9
And then remove the manual measuring from the RTF import. Sample output: comphelper::ProfileZone: RtfFilter::filter finished in 180 ms Change-Id: I85e2e12d82ff491a2991a41e5a6f6d1410e12363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89905 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>