summaryrefslogtreecommitdiff
path: root/cppuhelper
AgeCommit message (Collapse)AuthorFilesLines
2018-10-30Re-think cppu::throwException() and the C++/UNO bridge on iOSTor Lillqvist1-0/+8
It seems that on iOS, where we don't have any Java, Python, BASIC, or other scripting, the only thing that would use the C++/UNO bridge functionality that invokes codeSnippet() was cppu::throwException(). codeSnippet() is part of what corresponds to the code that uses run-time-generated machine code on other platforms. We can't generate code at run-time on iOS, that has been known forever. Instead we have used some manually written assembler to handle it instead. We used to have a Perl script to generate a set of code snippets for different cases, different numbers of parameters of the called function and whatnot, but that went away at some stage some year ago. (It is unclear whether that broke the C++/UNO bridge on iOS, or whether the stuff continued to work even after that.) Anyway, this handwritten assembly, or the manual construction of internal data structures for exceptions, or something else, seemed to have bit-rotten. Exceptions thrown with cppu::throwException() were not catchable properly any longer. Instead of digging in and trying to understand what is wrong, I chose another solution. It turns out that the number of types of exception objects thrown by cppu::throwException() is fairly small. During startup of the LibreOffice code, and loading of an .odt document, only one kind of exception is thrown this way... (The lovely css::ucb:InteractiveAugmentedIOException.) So we can simply have code that checks what the type of object being thrown is, and explicitgly throws such an object then with a normal C++ throw statement. Seems to work. Sadly the cppu::getCaughtException() API still needs some inline assembly in the C++/UNO brige. That seems to work though, knock on wood. This commit also adds a small "unit test" for iOS, copied from cppuhelperm to ImplSVMain(). Ideally we should not copy code around of course, but have a separate unit test app for iOS that would somehow include relevant unit tests from source files all over the place. Later. Change-Id: Ib6d9d5b6fb8cc684ec15c97a312ca2f720e87069 Reviewed-on: https://gerrit.libreoffice.org/60506 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit 7d6be61a62ca3724c67ab3fb93e60a2748d8a67e) Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2018-03-25Pre-load key UNO mappings.Michael Meeks1-0/+20
Change-Id: I415e07d737c734d63ac969783464babcbb9ea884 Reviewed-on: https://gerrit.libreoffice.org/48365 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 720759ad342000f2729a6c983523af931f01dbef)
2018-03-25lok: allow libraries to pre-init themselves.Michael Meeks1-0/+13
Populate static module references before entering a jail containing no code. Implement for scfilt, scui, swui, sdui. Change-Id: I8fec2aa78e67053a7945926c818122bd4290103c Reviewed-on: https://gerrit.libreoffice.org/49545 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit f215096c24429fe69e7e5ab37898d0f0beeff0ab)
2018-03-21Log just one line in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-3/+48
That *is* what we want, I guess, so better I do it proactively before I am told to do it. Sorry for the back and forth, but my main point in touching this code was anyway the filtering out of the component (the KDE4Backend thing) that causes a crash for me, at least, and which it presumably is fairly pointless to preload anyway. Also, filter out libraries that for some reason have an empty name. Change-Id: I2cffd51e67c23977e0779e7f0d6faaf59d8819d9 (cherry picked from commit 2ac1298b5f46a7dad44dbd57569b22d15d11f1e7)
2018-03-21Do use just std::cerr in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-3/+4
As the 1aedb6c4345719a963a883b13fa983db3ab4b9a8 commit message said, the point is that we want this output even with a LO built for production where SAL_INFO() and SAL_WARN() are no-ops. Change-Id: I5f788c3914286ca8df2c7e290150adae0be42820 (cherry picked from commit 29e7b95e9cd24b5b3d436fd5cceac40d36b0ac02)
2018-03-21Bin superfluous using declarationsTor Lillqvist1-3/+0
Change-Id: Icf8a2703b7e72f48bde1cc3bc6fd0de2e663a407 (cherry picked from commit 4a114d62957194ca60bdc9e4f857b36311a9bf22)
2018-03-21Don't try to preload the KDE4 shell backend as that crashesTor Lillqvist1-0/+7
Change-Id: I1c1ff4ec7cda00a76bdeb018366afed2187c7ef8 (cherry picked from commit 35ec045f6e4626c0544aaffbe489dfc142ff2aa8)
2018-03-21Simplify logging in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-39/+4
Use just SAL_INFO(), with tag "cppuhelper.preload". No unconditional writes to std::cerr. Also, log the loading attempt beforehand, so that it is printed before any crash during the loading of a component. (cherry picked from commit f9f830ac319aebd940ebcae97e51c24cda54508f) Change-Id: Ifde8be8cb5d18dd88df21c45c906deb575d36960
2017-11-25iOS, simplifyModule in cppuhelper is unusedlibreoffice-6-0-branch-pointjan Iversen1-0/+2
function simplifyModule is reported unused == error on iOS, therefore guarded with an #ifndef IOS Change-Id: I751cf68bd46ed17032251fede030f9082ce4e4f5
2017-11-25add cppu::throwException test caseCaolán McNamara3-0/+88
that is definitely run by the ubsan tinderbox to flush out cppuhelper/source/exc_thrower.cxx:201:15: runtime error: member call on address "foo" which does not point to an object of type 'cppuhelper::detail::XExceptionThrower' Change-Id: Ia798cc6695011480717c1a80d0ab7830080b5de1 Reviewed-on: https://gerrit.libreoffice.org/45244 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-25LOK: provide user feedback while preloading.Michael Meeks1-1/+41
Problems are hard enough to debug in a jailed kit process inside a docker image; provide some visual feedback via stderr. Change-Id: I54b0a21c1375be2acc9da0bbacf959a419471b08 Reviewed-on: https://gerrit.libreoffice.org/45256 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-10-27Better fix for CppunitTest_servicesStephan Bergmann2-5/+16
...than 25313923b08018bd837cfe3fc99a5e141602cafc "Fix CppunitTest_services for constructor-based implementations..." (which this commit reverts again). My claim that "the 'factory' would be the object itself" is nonsense, it would rather be an ImplementationWrapper (but one that was freshly created for each ServiceManager::createContentEnumeration). Change-Id: I85c683cff6f9ba78d0f8567a53f8fcbc56fe55cf
2017-10-23loplugin:constmethod in cppu,cppuhelper,idlcNoel Grandin2-3/+3
Change-Id: I9138b7e5d53c30488f99e9f9b9fe3f98c8d6858b Reviewed-on: https://gerrit.libreoffice.org/43583 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23overload std::hash for OUString and OStringNoel Grandin1-2/+1
no need to explicitly specify it anymore Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec Reviewed-on: https://gerrit.libreoffice.org/43567 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-05Rename and move SAL_U/W to o3tl::toU/WMike Kaganski1-1/+2
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-04add << operator for css::uno::ExceptionNoel Grandin7-15/+12
Change-Id: Ia23dafd07133779144965682df3b7125a3214235 Reviewed-on: https://gerrit.libreoffice.org/43046 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-09-27cppuhelper_detail_findSofficePath: use Unicode on WindowsMike Kaganski2-26/+51
On Windows, UTF-8 is never current locale encoding; so using 8-bit strings will always fail for paths containing characters outside of current codepage. Also fix leaks caused by failing to release its result: previously it could return either result of getenv (that shouldn't get freed), or an allocated string, but never got freed; now the result is always allocated and properly freed. Change-Id: I8b255dea20040eec0572de2b34280749fe8f071c Reviewed-on: https://gerrit.libreoffice.org/42743 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-21loplugin:flatten in connectivity..desktopNoel Grandin1-26/+22
Change-Id: Iff59d3049ba40b4338ef8eec67d08a96b0834d2b Reviewed-on: https://gerrit.libreoffice.org/42578 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-04loplugin:unnecessaryparen include c++ castsNoel Grandin1-1/+1
Change-Id: I132d3c66f0562e2c37a02eaf4c168d06c2b473eb Reviewed-on: https://gerrit.libreoffice.org/41874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-21cppuhelper: fix double checked locking in getTypeEntries()Michael Stahl1-0/+5
Change-Id: I73674f0293a57ed7c4d54aa6b68ff64d5ca4e7bd
2017-08-17remove unnecessary use of OUString::getStrNoel Grandin1-2/+1
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4 Reviewed-on: https://gerrit.libreoffice.org/38114 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-11convert std::map::insert to std::map::emplace IINoel Grandin4-18/+10
Change-Id: Ief8bd59c903625ba65b75114b7b52c3b7ecbd331 Reviewed-on: https://gerrit.libreoffice.org/41019 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-31update cppuhelper pchCaolán McNamara1-8/+5
Change-Id: Ifa6390c6665b6048e320a1a61f690ce980b40d6e Reviewed-on: https://gerrit.libreoffice.org/40582 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-07-31loplugin:oncevarNoel Grandin1-2/+2
extend oncevar to any POD type Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0 Reviewed-on: https://gerrit.libreoffice.org/40564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-21loplugin:constparams in soltools and variousNoel Grandin3-3/+3
Change-Id: I5e8e4a9a31aa7c3ff54cc7ce137d08770ea297e1 Reviewed-on: https://gerrit.libreoffice.org/40279 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-11use more range-for on uno::SequenceNoel Grandin1-3/+2
Change-Id: Ifad32425d79be5a22d33d721bdc5fb993f699759 Reviewed-on: https://gerrit.libreoffice.org/39763 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-05new loplugin unnecessaryparenNoel Grandin1-2/+2
Change-Id: Ic883a07b30069ca6342d7521c8ad890f4326f0ec Reviewed-on: https://gerrit.libreoffice.org/39549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-02loplugin:casttovoid: cppuhelperStephan Bergmann1-1/+0
Change-Id: I70a8f00b5ec9d100185d2865bcf54ce96c93adc3
2017-06-20android:Supress the Clang's unneeded-internal-declaration warningbrainbreaker1-1/+2
Change-Id: I76359e98a41206f914c3c05149f0a7eeeff1acc8 Reviewed-on: https://gerrit.libreoffice.org/39007 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-06-18remove unused osl/mutex.hxx includesJochen Nitschke1-1/+0
Change-Id: I3b50e45fdb99e9cd8bfda07356ee3ddb4dd0f8bb Reviewed-on: https://gerrit.libreoffice.org/38905 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-06-15use more SAL_N_ELEMENTS part 3Noel Grandin1-4/+2
Change-Id: I82e366fefd2e31928b99840fe76649cc3521e623 Reviewed-on: https://gerrit.libreoffice.org/38789 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06add COVERITY_NOEXCEPT_FALSECaolán McNamara1-1/+1
to markup dtors that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4 Reviewed-on: https://gerrit.libreoffice.org/38318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-06-05Improved loplugin:cstylecast to reference types: cppuhelperStephan Bergmann1-1/+1
Change-Id: Id442b7a76072fb346d927a7dd8659a05bb491f9b
2017-06-01Fix typosAndrea Gelmini1-1/+1
Change-Id: I3cd50e374c45bc1c400b24c8fffd6d8f5cd1de56 Reviewed-on: https://gerrit.libreoffice.org/38208 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-05-31Remove some unnecessary scaffolding around SAL_WARN callsStephan Bergmann4-5/+0
Change-Id: Iaec105d85a283ad15fdca6ffc5cf3d2ec5acac18
2017-05-30teach redundantcast plugin about functional castsNoel Grandin1-4/+4
Change-Id: Iac8ccd17d9e46ebb2cb55db7adb06c469bbd4ea0 Reviewed-on: https://gerrit.libreoffice.org/37910 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-28remove unnecessary use of OString::getStrNoel Grandin4-19/+8
Change-Id: I0490efedf459190521f4339854b3394d57765fdb Reviewed-on: https://gerrit.libreoffice.org/38058 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-12remove unused uno::Reference varsNoel Grandin1-1/+0
found by temporarily marking Reference as SAL_WARN_UNUSED. Change-Id: I18809b62654467f890016adcc92576980ced393b Reviewed-on: https://gerrit.libreoffice.org/37511 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-09cleanup osl/diagnose.h includesJochen Nitschke2-2/+0
with command > git grep -l osl/diagnose.h *.cxx | xargs grep -L -w 'OSL_\w*' | xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d' headers need more work Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab Reviewed-on: https://gerrit.libreoffice.org/37350 Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-07revert OSL_ASSERT changesChris Sherlock7-27/+27
Change-Id: I365d140446bd2a62cf8256acbfdd53fe72987380
2017-05-07tdf#43157: convert cppuhelper and io from OSL_ASSERT to assertChris Sherlock7-27/+27
Change-Id: I56d49e1ce9f1c070fedcabb8f1637d17dee1083b
2017-04-27tdf#39468 cleanup source code commentsdennisroczek1-2/+1
* translate German source code comments * remove ascii art * remove bogus source Code comments * remove old StarOffice/Sun internal bug tracker references Change-Id: I443bf2fdba3780c411d69809111daf3aa3a48451 Reviewed-on: https://gerrit.libreoffice.org/36005 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky4-4/+0
Uwinapi is discontinued. Change-Id: I063b4d0d8fab2d60de168e960a63b8181158ac01 Reviewed-on: https://gerrit.libreoffice.org/23198 Reviewed-by: David Ostrovsky <david@ostrovsky.org> Tested-by: David Ostrovsky <david@ostrovsky.org>
2017-04-12clang-tidy: readability-else-after-returnNoel Grandin8-127/+108
run it against sal,cppu,cppuhelper I had to run this multiple times to catch all the cases in each module, and it requires some hand-tweaking of the resulting output - clang-tidy is not very good about cleaning up trailing spaces, and aligning things nicely. Change-Id: I00336345f5f036e12422b98d66526509380c497a Reviewed-on: https://gerrit.libreoffice.org/36194 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-25Fix typosAndrea Gelmini1-1/+1
Change-Id: I56e429ff1b8ee55ccb8df16002b509770762172c Reviewed-on: https://gerrit.libreoffice.org/35618 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-23loplugins:redundantcast teach it about c-style typedef castsNoel Grandin1-4/+4
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-03-03Remove redundant 'inline' keywordStephan Bergmann4-5/+5
...from function definitions occurring within class definitions. Done with a rewriting Clang plugin (to be pushed later). Change-Id: I9c6f2818a57ccdb361548895a7743107cbacdff8 Reviewed-on: https://gerrit.libreoffice.org/34874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-28new loplugin unoanyNoel Grandin1-1/+1
Change-Id: I5d6c4a67cb2a09e7cd5bd620c6b262d188701b89 Reviewed-on: https://gerrit.libreoffice.org/34714 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-24makeAny->Any in cppuhelper..cuiNoel Grandin6-28/+28
Change-Id: Ia54e6e9b71df68bd04c304a0bb02da8ebac74420 Reviewed-on: https://gerrit.libreoffice.org/34603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-21loplugin:subtlezeroinit: cppuhelperStephan Bergmann1-2/+2
Change-Id: I405ba174a4397938415eee6108ca1f0687b4649a