summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)Author
2015-07-27inline a bunch of use-once macrosNoel Grandin
no point in having a macro unless it's actually going to reduce the number of lines of code Change-Id: Ic8760d6506cf272d7bd088f7b3b4dcbf288099fc
2015-07-23coverity#1312138 Resource leakCaolán McNamara
Change-Id: Ib3f5665f336fb933fbfa88a1032d76d881b38196
2015-07-21loplugin:cstylecastNoel Grandin
Change-Id: If877cd61000fe6b82083a9fff79c25364d49e721
2015-07-20use osl_get_system_random data in rtlRamdomPoolNorbert Thiebaud
substitute as much as possible getting directly random data from the system rather than mixing our own pseudo-random numbers Fall back on the home-grown method if for some reason system random does not work. (on windows rand_s() is said to be able to return errors, beyond EINVAL, but they are just not listed.. so who knows) Change-Id: I71e88e097a9f3587086a710e9a785d61c560785e Reviewed-on: https://gerrit.libreoffice.org/15474 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2015-07-20add an internal api to osl to collect 'native' random numbersNorbert Thiebaud
use /dev/urandom on unixes and rand_s() on windows Change-Id: Iccd6e01706f16d82f23cda0f0a410953c32fbc02 Reviewed-on: https://gerrit.libreoffice.org/15473 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2015-07-16loplugin:simplifyboolStephan Bergmann
Change-Id: I9c4be053a8e39683e0d557a7a6be109507374d70
2015-07-15Log the actual string, not the rtl_uString pointer valueTor Lillqvist
Change-Id: I51938f4801436aff31b51fd36c89582062f83b9a
2015-07-13Make content of OSL_ASSERT, DBG_ASSERT, etc. visiblie in non-debug buildsStephan Bergmann
...to avoid lots of loplugin:staticmethods warnings. Also enables DBG_ASSERT etc. also for --enable-debug builds in addition to --enable-dbgutil builds. Change-Id: Ib89ecd9ab8ce7abb2c64790ace248b31f9d2b64d
2015-07-10cleanup some unnecessary direct usage of the OString/OUString C API.Noel Grandin
Change-Id: I6edee95aae1c169ce70063562a0c1b287e0c4735 Reviewed-on: https://gerrit.libreoffice.org/16861 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-09Do not call SAL_N_ELEMENTS on empty arrayStephan Bergmann
Change-Id: I8b73c61a9662079927344029eb9872c6a19aad76
2015-07-08Fix typosAndrea Gelmini
Change-Id: I020c7ce4d9aa93cb0292378a410cdb9f7788e920 Signed-off-by: Michael Stahl <mstahl@redhat.com>
2015-07-07performance tuning of rtl_ustr_indexOfAscii_WithLength()Norbert Thiebaud
lcov over make check showed 98 4699997 : sal_Int32 rtl_ustr_indexOfAscii_WithLength( 99 : sal_Unicode const * str, sal_Int32 len, 100 : char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C() 101 : { 102 4699997 : assert(len >= 0); 103 4699997 : assert(subLen >= 0); 104 4699997 : if (subLen > 0 && subLen <= len) { 105 : sal_Int32 i; 106 54014537 : for (i = 0; i <= len - subLen; ++i) { 107 51036513 : if (rtl_ustr_asciil_reverseEquals_WithLength( 108 51036523 : str + i, subStr, subLen)) 109 : { 110 205482 : return i; 111 : } 112 : } 113 : } 114 4494505 : return -1; 115 : } so 1/ in 95% of the cases the result is not-found.. _that_ is the hot path 2/ we are calling rtl_ustr_asciil_reverseEquals_WithLength close to 11 times per call.. (average ~ len - subLen, due to the high miss ratio) so let's first search for the first byte of the substring to optimize the 'miss' case, which is the most common one. Change-Id: I20ef0821db2ff0db5935dd562844a947a14aff64 Reviewed-on: https://gerrit.libreoffice.org/16763 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2015-07-06Clarify treatment of double slashes in rtl::Uri::convertRelToAbsStephan Bergmann
Change-Id: I71d0ded04b35472f14e4764a47212c73ac500814
2015-07-04Fix typosAndrea Gelmini
Change-Id: Iddcc22f62ea134ea797292daa02e47042d52d0d1 Reviewed-on: https://gerrit.libreoffice.org/16710 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
2015-06-30Coverity 1308555, 1308562, 1308600: Drop some SAL_THROW_EXTERN_CStephan Bergmann
...from most rtl/bootstrap.h functions. They are effectively only called from C++ code (there is no plain C UNO binding), so it should be fine to let std exceptions (like bad_alloc or length_error) propagate from their implementations to call sites. (The exception is rtl_bootstrap_args_close, which is typically called from C++ dtors, so should not throw anyway.) This would strictly speaking be an [API CHANGE], but it should make no practical difference whether a process terminates abruptly because an exception cannot pass through a SAL_THROW_EXTERN_C() nothrow specification or because legacy client code does not expect exceptions to be thrown from functions from which SAL_THROW_EXTERN_C() has now been removed. Change-Id: I08e8479e9c5731e46021aadd6a725c1793024d10
2015-06-28Fix typosAndrea Gelmini
Change-Id: I80995af6459af9f647e66d1c85da2eedad2647b9 Reviewed-on: https://gerrit.libreoffice.org/16523 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2015-06-26loplugin:stringconstant: handle OUString+=OUString(literal)Stephan Bergmann
Change-Id: Ia304622214c47d35387dd0393db8e9afa55118f2
2015-06-26Add optimized OUString += literal overloadStephan Bergmann
Change-Id: Ib34196185f90204a71598f2c659c3fddce7a0e4d
2015-06-25Revert "Revert "Generalize OUStringLiteral1""Stephan Bergmann
This reverts commit 5cba714b4d03ed54debf71534ad8c8edc383a01e, now including a workaround for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53658> "internal compiler error -- segmentation fault." Change-Id: I31f6d9ddcb0b884134703df2b9dc1800ba0a84be
2015-06-25Do not forget to actually set newStr to an empty stringStephan Bergmann
Change-Id: I745b09d8a248f08afdd3387f4cfcf69d71ec3c39
2015-06-24Revert "Generalize OUStringLiteral1"Stephan Bergmann
This reverts commit 4d4f3512db0cf0bf47c2ba1b39c3813842903ef7, at least "gcc version 4.8.3 20140627 [gcc-4_8-branch revision 212064] (SUSE Linux)" fails with "include/rtl/stringutils.hxx:175:49: internal compiler error: Segmentation fault."
2015-06-24Generalize OUStringLiteral1Stephan Bergmann
...by making all places that accept a string literal via ConstCharArrayDetector also accept an OUStringLiteral1 via ConstCharArrayDetector (which required some tweaking of the ConstCharArrayDetector internals). That removes the need for special-purpose OUStringLiteral1 overloads, and will allow OUStringLiteral1 to be used in more places. Change-Id: I370de8480e02f8423cde5677dd38479b81bccdb2
2015-06-23Revert "Typo: iff->if"Julien Nabet
This reverts commit cf92da3d6e1de14756efe3f1ee79f393a2f3787d. iff can mean "if and only if" so not a typo
2015-06-23Typo: iff->ifJulien Nabet
Change-Id: I3fc60856b5a56e71d70b55c89323be074bdec3b3
2015-06-23Implement full set of OUString::replaceFirst/All literal overloadsStephan Bergmann
Change-Id: I5f525d91ce24d1d2653a6855f1c4fffc039ae398
2015-06-23typoStephan Bergmann
Change-Id: I80e32c8198a153a16e6a91921dff025bf5bd3170
2015-06-23Make test code unaffected by upcoming loplugin:stringconstant improvementsStephan Bergmann
Change-Id: If375073001690e1ce2f8d18a3f128358f22aa98b
2015-06-17Replace boost::scoped_array<T> with std::unique_ptr<T[]>Takeshi Abe
This may reduce some degree of dependency on boost. Done by running a script like: git grep -l '#include *.boost/scoped_array.hpp.' \ | xargs sed -i -e 's@#include *.boost/scoped_array.hpp.@#include <memory>@' git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \ | xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/' ... and then killing duplicate or unnecessary includes, while changing manually m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx, extensions/source/ole/unoconversionutilities.hxx, and extensions/source/ole/oleobjw.cxx. Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd Reviewed-on: https://gerrit.libreoffice.org/16289 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-06-16Fix typosAndrea Gelmini
Change-Id: I549635318f46718042e50c8f89ce3c620cade990 Reviewed-on: https://gerrit.libreoffice.org/16281 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2015-06-15cppcheck:unreadVariableNoel Grandin
Change-Id: I03981ceba67280e8ed98a9add7f24b3bd958d522
2015-06-15cppcheck:redundantAssignmentNoel Grandin
Change-Id: I1167d0ce6b6f6e48309d0551c1d2a283d79546a7
2015-06-13TyposJulien Nabet
Change-Id: I21c352a63d668c174eef212dbfbe6346c678ce4d
2015-06-08loplugin:cstylecast: deal with remaining pointer castsStephan Bergmann
Change-Id: Ibd373cddb1e25f05528e627349953b5f7d115330
2015-06-02-fsanitize=nonnull-attribute in memcpy callStephan Bergmann
Change-Id: If1f852ce4ef3419d663d4e2f4bdb4a57cc61e799
2015-06-02-fsanitize=nonnull-attribute in memcpy callStephan Bergmann
Change-Id: Ic2fc0752f2bce2d565ca58b1c804bfd601b80875
2015-06-02loplugin:cstylecast: deal with those that are (technically) const_castStephan Bergmann
Change-Id: Iad01e628b692a6dcf882696908de0ef1f24c04c4
2015-05-29loplugin:redundantcast: Work around OS X memchr bugStephan Bergmann
...where in C++ memchr does not have exactly the two overloads void const * memchr(void const *, int, size_t) void * memchr(void *, int, size_t) but rather the C void * memchr(void const *, int, size_t) shining through (see bugreport.apple.com issue 21128245 "non-conforming memchr in C++"), which gets in the way of the upcoming improved redundant const_cast check in loplugin:redundantcast. Change-Id: I7001e74e03429ef23682d52da28fca435130d775
2015-05-18loplugin:staticmethodsStephan Bergmann
Change-Id: Ie225e9816a626e2581b8309f59519ab99e1af04a
2015-05-11sal: don't build cppunittester if cross-compilingMichael Stahl
Change-Id: I4e2d884b2f87572dc22fece897e384bdaa7506cc
2015-05-11loplugin:cstylecast: nop between pointer types of exactly same spellingStephan Bergmann
Change-Id: Ia7902a4bf2ec9bc995dfa065fe9e2eb092613683
2015-05-10cppcheck: help out unusedScopedObject false positiveCaolán McNamara
Change-Id: I0df7a930ff970c26fbbb03d9333108ee3cae7ad4
2015-05-09coverity#1297235 Uncaught exceptionCaolán McNamara
Change-Id: I6b135f6d47352c1fbb729788848913402b7bb742
2015-05-08Use bool instead of intStephan Bergmann
Change-Id: Ib5920745f9f464493b7b134f871e090726d17d0c
2015-05-01Actually, let's just delete the now commented-out SAL_INFO linesTor Lillqvist
(It was I who added them in the first place.) Next time somebody (falsely?) suspects a problem with mutex use and really needs tracing, it's trivial to add temporary SAL_DEBUGs. Change-Id: I3db02be777a728fbf4a1d1962f0ccfa16c630f15
2015-05-01Let's disable these too then for consistencyTor Lillqvist
Change-Id: I17d17b1cad83a55f9a2c0db80e272c419529b45a
2015-05-01sal: disable some over-eager SAL_INFOMichael Stahl
These call malloc so often that valgrind forgets where the things i'm looking for were freed, because the address has already been re-used. Change-Id: I8e1a0f739a774972d3afe750250ee79262c79b85
2015-04-30provide a way to execute single test case from test suiteMarkus Mohrhard
CPPUNIT_TEST_NAME is the environment variable that needs to be set and contain the name of the tests. The test names need to be fully qualified to be recognized. Examples: CPPUNIT_TEST_NAME="ScFiltersTest::testOutlineODS ScFiltersTest::testRangeNameXLS" make CppunitTest_sc_subsequent_filters_test CPPUNIT_TEST_NAME="ScFiltersTest" make CppunitTest_sc_subsequent_filters_test Change-Id: I78a8a076638e19c918ca1c411086bb353f5100a2 Reviewed-on: https://gerrit.libreoffice.org/15579 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-04-30Bin some pointless comments and reduce some vertical whitespaceTor Lillqvist
Bin pointless '// predeclarations' or '// forward declarations' comments. If a programmer doesn't know what a forward declaration is, well, why read C++ source code? Also bin some pointless '// end of namespace foo' comments after namespace blocks just a handful of lines long, and some superfluous vertical whitespace. Change-Id: I2a31c5d73d9b4de8825fb8eb9e7559dbd7303ef9
2015-04-27More loplugin:simplifyboolStephan Bergmann
Change-Id: I9414d9167213c0156fb97559a8af5e55a4e1c1de
2015-04-23cppcheck: uselessAssignmentArgCaolán McNamara
Change-Id: I94be63174d996069fc5ec9c93d14ccd5a39cb029