summaryrefslogtreecommitdiff
path: root/sal/rtl
AgeCommit message (Collapse)Author
2019-11-12Silence -Werror=sign-compare (--enable-cipher-openssl-backend)Stephan Bergmann
as found by <https://ci.libreoffice.org/job/lo_tb_random_config_linux/2039/> Change-Id: Ie698b7905bd2f25e74791f91f586479d1fc473dc Reviewed-on: https://gerrit.libreoffice.org/82488 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-31tdf#125688 speed up load of change-tracking ODSNoel Grandin
by 10%, by avoiding an OUString construction in a hot path through XMLTextColumnContext_Impl::XMLTextColumnContext_Impl -> sax::Convert::convertNumber Also changed XMLTextAnimationStepPropertyHdl::importXML to take advantage of the modified convertNumber passing convention. Change-Id: I4e5503dbb094c88a09af8b6dc8c22b6c53f9eb75 Reviewed-on: https://gerrit.libreoffice.org/81726 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-21size some stringbuffer to prevent re-allocNoel Grandin
found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14loplugin:stringadd look for unnecessary temporariesNoel Grandin
which defeat the *StringConcat optimisation. Also make StringConcat conversions treat a nullptr as an empty string, to match the O*String(char*) constructors. Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b Reviewed-on: https://gerrit.libreoffice.org/80724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-17Better handling of non--UTF-8 filesystem pathnames in sal/osl/unx/Stephan Bergmann
The idea is to internally in sal/osl/unx/ use OString instead of OUString to represent pathnames, so that the OString carries the actual bytes that make up the pathname. At the boundary of translating between pathname OStrings and file URL OUStrings, translate sequences of bytes that are valid according to osl_getThreadTextEncoding() into UTF-8 and translate other bytes into individual (percent-encoded) bytes in the file URL. This change required duplicating some of the internal functionality in sal/osl/unx/ for both OString and OUString, and to make part of sal/rtl/uri.cxx accessible from sal/osl/unx/ via new sal/inc/uri_internal.hxx. Change-Id: Id1ebaebe9e7f2d21f350f6b1a07849edee54331f Reviewed-on: https://gerrit.libreoffice.org/78798 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-06Fixing "...."Andrea Gelmini
Change-Id: I3424e17cfdfb563fdc5882942031deafae8689fe Reviewed-on: https://gerrit.libreoffice.org/78678 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-09Resolves: tdf#126766 fix rounding correction at start of negative valuesEike Rathke
doubleToString() is entered with an inaccuracy afflicted fValue=-9999.9999999999927 for which the rounding into the next magnitude incremented the '-' character to '.' instead of appending a '1' (and '0' and then "000") thus yielded ".0000" instead of "-10000" This seems to have been always the case. Change-Id: I66170defa71fec40ca0b85f68affde8eff0d5ccb Reviewed-on: https://gerrit.libreoffice.org/77208 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2019-08-02Fix typosAndrea Gelmini
Change-Id: Ie183c445bf8a545f59aac7b0e29f72ab679a6cf3 Reviewed-on: https://gerrit.libreoffice.org/76852 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): salStephan Bergmann
Change-Id: Id9d994343d10b5d5e852b10946c036dfbeb66d04 Reviewed-on: https://gerrit.libreoffice.org/76656 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-04-13loplugin:sequentialassign in salNoel Grandin
Change-Id: I7bd1511a6acc105ab5b42c698c7578cfb9ce06b4 Reviewed-on: https://gerrit.libreoffice.org/70708 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-12Simplify containers iterations in reportdesign, sal, saxArkadiy Illarionov
Use range-based loop or replace with STL functions Change-Id: If6b734dab12a7298fce16003d3d175305fbe798d Reviewed-on: https://gerrit.libreoffice.org/67701 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 Kaganski
Change-Id: I67462369d93e9d9ff3c056800947c4b75f71ba5f Reviewed-on: https://gerrit.libreoffice.org/67486 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-02-10tdf#39593 use existing find() to reduce copypasteArkadiy Illarionov
Change-Id: Id6280424627a3bbcb484d61cee2f2003aa1ca9b6 Reviewed-on: https://gerrit.libreoffice.org/67604 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-09loplugin:indentation in registry..saxNoel Grandin
Change-Id: I4b877751818febaec8e64018335dca691a476a43 Reviewed-on: https://gerrit.libreoffice.org/67561 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-08Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann
...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-01A leading or trailing group separator character is not a group separatorEike Rathke
Also a group separator character followed by a non-digit is not. Change-Id: Id57e43fe7692706c5532fb05ad394224265c2750 Reviewed-on: https://gerrit.libreoffice.org/64358 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-11-29Rename Mac OS X to official name macOS in comments and documentationBartosz Kosiorek
Change-Id: I651b7f202fa52ff5f5357a11aa72c43eb7dc7f95 Reviewed-on: https://gerrit.libreoffice.org/64102 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2018-11-22improve function-local statics in salNoel Grandin
Change-Id: I0853cf13162bae44cf8a5c44a4546a73f05772d9 Reviewed-on: https://gerrit.libreoffice.org/63780 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-16loplugin:buriedassign in sd..writerfilterNoel Grandin
Change-Id: I954c12d9e1c493be6ac8c7b15076077b5bff5b74 Reviewed-on: https://gerrit.libreoffice.org/62811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-11Fix typoAndrea Gelmini
Change-Id: Id2478ac637140b604cb0f7e3aa4267f02aa859c4 Reviewed-on: https://gerrit.libreoffice.org/63255 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-11-07loplugin:collapseif in framework..salNoel Grandin
Change-Id: I3068b18f5cff024a48a8f8c68d69cadad30fe4d5 Reviewed-on: https://gerrit.libreoffice.org/62953 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-04replace double-checked locking patterns with thread safe local staticsMike Kaganski
Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323 Reviewed-on: https://gerrit.libreoffice.org/62839 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27tdf#120703 (PVS): V519 The variable is assigned values twice successivelyMike Kaganski
Change-Id: I9265425a215609ef6bf4298ba39c8399f215ce27 Reviewed-on: https://gerrit.libreoffice.org/62406 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-24remove more rtl::OUString and OString prefixesNoel Grandin
which seem to have snuck back in since the great rounds of removals. Change-Id: I85f7f5f4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-20use rtl_secureZeroMemory when we're zeroing temporaries before returningCaolán McNamara
Change-Id: I0c3efa394511e479d925f5320977d071e8301f8d Reviewed-on: https://gerrit.libreoffice.org/62002 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-12loplugin:constfields in reportdesign,sal,saxNoel Grandin
and improve the rewriter so I spend less time fixing formatting Change-Id: Ic2a6e5e31a5a202d2d02a47d77c484a57a5ec514 Reviewed-on: https://gerrit.libreoffice.org/61676 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-05use std::unordered_map in localeNoel Grandin
instead of hand-coded hash table Change-Id: I1c52f98b5a72609f7cd8086227017a486d97520e Reviewed-on: https://gerrit.libreoffice.org/60706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann
...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-14These rtl_hash* functions appear to never have been exported from salStephan Bergmann
They were introduced with 9399c662f36c385b0c705eb34e636a9aec450282 "initial import" without any trace of being exported DLLPUBLIC-style, and were probably included in error in the initial sal/util/sal.map when that was introduced in 92b0714c409bd3cffcefd338371ee000fa1b5805 "new". That means the functions themselves can be moved from extern "C" to an unnamed namespace (and the resulting loplugin:salbool warnings be fixed). Change-Id: Ida99540edce9560e69081f507e41db2af34966fb Reviewed-on: https://gerrit.libreoffice.org/60469 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-07Cppcheck: reduce variable scopeMike Kaganski
Change-Id: I5660fe6ddc745894c1e36176f4aa38ad568f09ba Reviewed-on: https://gerrit.libreoffice.org/60119 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-08-31-Werror,-Wunused-parameterStephan Bergmann
(--disable-assert-always-abort --enable-cipher-openssl-backend) Change-Id: I0cf10fd6c788432a3312048cbde31ccc6f8fcbad Reviewed-on: https://gerrit.libreoffice.org/59860 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-29replace rtl_allocateMemory with std::mallocNoel Grandin
where used directly, since rtl_allocateMemory now just calls into std::malloc Change-Id: I59f85bdb7efdf6baa30e8fcd2370c0f8e9c999ad Reviewed-on: https://gerrit.libreoffice.org/59685 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-27directly use malloc/free in sal, instead of rtl_allocateMemory/etcNoel Grandin
now that those functions are entirely malloc/free based, we can skip a function call layer. Change-Id: Ib091de0bdf4cdd58cee45185df17d96d3e8af402 Reviewed-on: https://gerrit.libreoffice.org/59576 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-23rhbz#1618703: Allow to use OpenSSL as backend for rtl/cipher.hStephan Bergmann
...with new configuration option --enable-cipher-openssl-backend rtl/cipher.h (which is part of the stable URE interface) offers functionality to en-/decrypt data with Blowfish in ECB, CBC, and streaming CFB mode, and with RC4 (aka ARCFOUR; which is a stream cipher). LO itself only uses Blowfish CFB and RC4, so only those are wired to OpenSSL for now, for simplicity. Using Blowfish ECB and CBC, or Blowfish CFB in DirectionBoth mode would cause failures for now (cf. sal/qa/rtl/cipher/rtl_cipher.cxx); the assumption is that no external code actually makes use of this functionality. Using NSS instead of OpenSSL could be an alternative, but there appears to be no support in NSS for Blowfish in streaming CFB mode, only CKM_BLOWFISH_CBC for CBC mode. Change-Id: I0bc042961539ed46844c96cb1c808209578528a0 Reviewed-on: https://gerrit.libreoffice.org/59428 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-06Add missing sal/log.hxx headersGabor Kelemen
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') in files formerly omitted for oversight or non-cxx extension Change-Id: I327c573f44076c6ccfecf737eafccba2da72e1bd Reviewed-on: https://gerrit.libreoffice.org/58600 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-08-02[API CHANGE] add some more asserts to the string functionsNoel Grandin
rtl_[u]String_alloc now requires that the length be >= 0. Since this function is only @since Libreoffice 4.1, it is unlikely to be widely used externally. Removed some unit tests that were testing invalid or out of range paramers, which are already not allowed according to the documented contract of those functions. The change in writerfilter is because the new asserts triggered when running testFdo74745 The change in SwTextNode::EraseText is because testFdo60842 triggered the assert in replaceAt. The change in SwFieldSlot::SwFieldSlot is because testMoveRange::Import_Export_Import triggered the assert in replaceAt. The changes in SwFieldSlot::SwFieldSlot and TabControl::ImplGetItemSize are due to failures in the uitests. Change-Id: Ib317261067649b0de96df12873ce31360cd24681 Reviewed-on: https://gerrit.libreoffice.org/58390 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-02Use memcpy for string ImplNewCopy functionsNoel Grandin
Change-Id: If0072a2fd7d3111b48413143610025124f365207 Reviewed-on: https://gerrit.libreoffice.org/58275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-02Revert rtl_alloc_preInit back to boolean argumentStephan Bergmann
This effectively reverts 271a663d2f098f3f665cab6da2e13b265a7eab93 "rtl: support start/stop threads around pre-init" again, now that df6ba650469a6f2fda06ef1c2e107ccdd3570505 "Remove 'officially dead now' rtl_cache slab allocator mechanism" removed the wsupdate thread. (rtl_alloc_preInit is an internal-use-only C function, so changing its arguments doesn't affect URE compatibility.) Change-Id: Ie9bce86377f9520e2600e4111ac525dddace10f8 Reviewed-on: https://gerrit.libreoffice.org/58443 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-01Dead assignmentStephan Bergmann
Change-Id: Ia9459d29ebe823a8e08eed0a7418e89b05ed360b Reviewed-on: https://gerrit.libreoffice.org/58412 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-01Remove "officially dead now" rtl_cache slab allocator mechanismStephan Bergmann
...after <https://gerrit.libreoffice.org/#/c/58263/> "the custom SAL allocator is no longer used" got merged. According to my July 31, 2018 comment there: "However, [...] this change is effectively a final coffin nail for the 'rtl_cache' mechanism. It could be argued that the alleged benefits of that mechanism (if it were still working) might be real (at least on some platforms; which would need measurements), and that it should be made working again (by reverting the effects of both ce906b8096081dee15dc8cc96e570d5b0b587955 'skip tricky allocators on G_SLICE=always-malloc' and bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 'Disable custom allocator' on rtl_cache_alloc/free again). But it could just as well be argued that the 'rtl_cache' mechanism is effectively gone for long enough now (since end of November, 2017, with bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 'Disable custom allocator') without any (apparent) negative consequences, so that it can be removed for good with this change." Change-Id: I8c1e45d494fc22555a9e675ab27be9e6e404abde Reviewed-on: https://gerrit.libreoffice.org/58369 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-31the custom SAL allocator is no longer usedNoel Grandin
ever since commit bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 Date: Wed Nov 15 16:52:44 2017 +0530 Disable custom allocator which makes FORCE_SYSALLOC redundant which makes SYS_ALLOC redundant Change-Id: I42e1d651473e7601e2280d9fb0662c89808c88f6 Reviewed-on: https://gerrit.libreoffice.org/58263 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2018-07-30avoid writing StringBuffer twiceNoel Grandin
Change-Id: Ib0a8914cc1967f89a2cd3b062e7a0b52de7a972c Reviewed-on: https://gerrit.libreoffice.org/58281 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-29bChanged can be boolNoel Grandin
Change-Id: I7d3f6af5410d93537b6b7a704615f43860160320 Reviewed-on: https://gerrit.libreoffice.org/58278 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-29Use memmove in trim_WithLengthNoel Grandin
Change-Id: If75ac1968b8b0b3314ae36c2a7f163cb5428e9c6 Reviewed-on: https://gerrit.libreoffice.org/58277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-29optimise newFromStr functionsNoel Grandin
use the other functions in this module so we get the compiler builtins if available Change-Id: Idbd9df44e057e573dd3fb243c50c5186e8edd8d8 Reviewed-on: https://gerrit.libreoffice.org/58276 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-27Related: rhbz#1602589 add comments to coverity annotationsCaolán McNamara
Change-Id: I88c941832a0d682ea4b6028c28edd48cf5df38f7 Reviewed-on: https://gerrit.libreoffice.org/58093 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-28tdf#42949 Fix IWYU warnings in include/osl/*hGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib2301526d7aa6982af6c8c79ed7e9a4c34b7bbf7 Reviewed-on: https://gerrit.libreoffice.org/56491 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-18Resolves: tdf#118073 one leading 0 is significant for 0.Eike Rathke
Regression from commit 9a6527a98fb968b3fe6bc293ff7520a9480d43d0 CommitDate: Mon Jun 27 21:57:52 2016 +0200 stringToDouble() do not parse separator without digit as 0.0 Change-Id: I9d90aedc324ef0938297224297d89817e3fd1e90 Reviewed-on: https://gerrit.libreoffice.org/56028 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-06-11new loplugin:shouldreturnboolNoel Grandin
look for methods returning only 1 and/or 0, which (most of the time) should be returning bool. Off by default, because some of this is a matter of taste Change-Id: Ib17782e629888255196e89d4a178618a9612a0de Reviewed-on: https://gerrit.libreoffice.org/54379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>