Age | Commit message (Collapse) | Author |
|
Change-Id: I6b40642c7574a1863658854d206ed849517dbd0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122130
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
|
|
Following up on f62cb40bdfaf41cf8e989640f9be79f652f30914 "Remove dubious #pragma
pack" and 9eba8aa38db3a0dc2f7dfaf24a003c16418aef18 "Remove dubious #pragma pack"
for O[U]StringLiteral, which argued that the pragma pack around rtl_[u]String
are useless cargo cult (paraphrasing): "All struct member types involved
(oslInterlockedCount aka sal_Int32, sal_Int32 itself, sal_Unicode, and char)
have size <= 4 resp. < 8, so the member alignment ("on a boundary that's either
a multiple of [the pragma pack value], or a multiple of the size of the member,
whichever is smaller", according to
<https://docs.microsoft.com/en-us/cpp/preprocessor/pack?view=msvc-160>) is not
affected. And neither are alignof(rtl_String) and alignof(rtl_uString)
affected, which would remain e.g. 4 on x86-64."
(Curiously, the pragma pack value had always been 8 for rtl_String but 4 for
rtl_uString, ever since at least 9399c662f36c385b0c705eb34e636a9aec450282
"initial import".)
The plan is as follows: In step 1, add temporary static_asserts that state the
current alignof/sizeof values; keep this for a while to see that all relevant
Windows builds actually agree on these status-quo values. In step 2, remove the
pragma pack cargo cult; keep the static_asserts for a while to see that the
removal has no impact on any of the relevant Windows builds. Finally, in
step 3, remove the temporary static_asserts again.
Change-Id: I8059ac300cc5b517db4a575f0eaba48678966537
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114540
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Extending this:
https://gerrit.libreoffice.org/c/core/+/110512
Change-Id: I1c5bfcddeb0f5619dc848bbf02408cf166bebc8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110521
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
This has at least better IDE support, with easier lookup for function
implementations.
Change-Id: I0e4cfe40df036efa796c057852bd5cb4421507f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108931
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
|
|
...that take a pointer and a length, and where it should be OK that the pointer
is null if the length is zero. Those rtl_uString_* functions are targets of
OUString member functions that take std::[u16]string_view arguments, and
19926ed35ebb623fc896942b1f232b83edf1fc1e "loplugin:stringview: Flag empty string
converted to string view" (which changed some call sites to pass in default-
constructed std::[u16]string_view, for which data() returns null) revealed that
those rtl_uString_* functions were not prepared for such input.
(The guardings of memcpy are necessary because memcpy still requires its pointer
arguments to be non-null, even if the corresponding length is zero.)
The new sal/qa/rtl/strings/test_strings_defaultstringview.cxx systematically
tests all O[U]String[Buffer] member functions taking std::[u16]string_view
arguments. It revealed one further issue in
IMPL_RTL_STRNAME(compare_WithLength), where UBSan reported a
nullptr-with-nonzero-offset
> sal/rtl/strtmpl.cxx:149:9: runtime error: applying non-zero offset 18446744073709551614 to null pointer
Also, rtl_uString_newReplaceFirstUtf16LUtf16L was found to lack a check for its
`from` argument to be non-null.
Change-Id: I6a7a712570f7d1e8d52097208c8a43a5a24797af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106295
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I2ce95de07b8e0952a1e778e65940b30597396aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...instead of having individual overloads for OUString, OUStringLiteral, and
literal char16_t const[N]. (The variants taking OUString are still needed for
!LIBO_INTERNAL_ONLY, though. The variants taking ASCII-only literal char
const[N] are also left in place.)
This nicely reduces the number of needed overloads. std::u16string_view allows
to pass as arguments:
* OUString
* OUStringLiteral
* OUStringChar (with the necessary conversion added now)
* OUStringNumber
* u"..." char16_t string literals
* u"..."sv std::u16string_view literals
* std::u16string, plain char16_t*, and more
A notable exceptions is OUStringConcat, which now needs to be wrapped in
OUString(...), see the handful of places that needed to be adapted.
One caveat is the treatment of embedded NUL characters, as
std::u16string_view(u"x\0y")
constructs a view of size 1, while only
u"x\0y"sv
constructs a view of size 3 (which matches the old behavior of overloads for
literal char16_t const[N] via the ConstCharArrayDetector<>::TypeUtf16
machinery). See the new checkEmbeddedNul in
sal/qa/rtl/strings/test_oustring_stringliterals.cxx.
The functions that have been changed are generally those that:
* already take a string of determined length, so that using std::u16string_view,
which is always constructed with a determined length, is no pessimization
(e.g., there are operator == overloads taking plain pointers, which do not
need to determine the string length upfront);
* could not benefit from the fact that the passed-in argument is an OUString
(e.g., the corresponding operator = overload can reuse the passed-in
OUString's rtl_uString pData member);
* do not run into overload resolution ambiguity issues, like the comparison
operators would do.
One inconsistency that showed up is that while the original
replaceAll(OUString const &, OUString const &, sal_Int32 fromIndex = 0)
overload takes an optional third fromIndex argument, the existing replaceAll
overloads taking OUStringLiteral and literal char16_t const[N] arguments did
not. Fixing that required a new (LIBO_INTERNAL_ONLY)
rtl_uString_newReplaceAllFromIndexUtf16LUtf16L (with test code in
sal/qa/rtl/strings/test_strings_replace.cxx).
Another issue was posed by test code in
sal/qa/rtl/strings/test_oustring_stringliterals.cxx that used the
RTL_STRING_UNITTEST-only OUString(Except*CharArrayDetector) ctors to verify that
certain function calls should not compile (and would compile under
RTL_STRING_UNITTEST by taking those Except*CharArrayDetector converted to
OUString as arguments). Those problematic "should fail to compile" tests have
been converted into a new CompilerTest_sal_rtl_oustring.
Change-Id: Id72e8c4cc338258cadad00ddc6ea5b9da2e1f780
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102020
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: I022f5ed37d25f2c8a8870033bab32ff59d4d8da6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97648
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I5a7bc9378ceacb9116c03e3a9fc01c5675c40908
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92243
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: I6d32942960a5e997f16eb1301c45495661cd4cea
Reviewed-on: https://gerrit.libreoffice.org/85514
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
To mitigate the dangers of silently breaking ADL when moving enums into unnamed
namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79
"New loplugin:external"), note all functions that are affected. (The plan is to
extend loplugin:external further to also warn about classes and class templates,
and the code to identify affected functions already takes that into account, so
some parts of that code are not actually relevant for enums.)
But it appears that none of the functions that are actually affected by the
changes in this commit relied on being found through ADL, so no adaptions were
necessary for them.
(clang::DeclContext::collectAllContexts is non-const, which recursively means
that External's Visit... functions must take non-const Decl*. Which required
compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support
such Visit... functions with non-const Decl* parameters.)
Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd
Reviewed-on: https://gerrit.libreoffice.org/83001
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: Id2478ac637140b604cb0f7e3aa4267f02aa859c4
Reviewed-on: https://gerrit.libreoffice.org/63255
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
|
|
Change-Id: Ib7ad23257a966447d627b4f73698d9298790f759
Reviewed-on: https://gerrit.libreoffice.org/49042
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
|
|
with something like
git grep -nP '(.*)\s*<\s*(.*)\s*\?\s*\g1\s*:\s*\g2' -- *.?xx
Change-Id: Id5078b35961847feb78a66204fdb7598ee63fd23
Note: we also convert a>b?b:a
Reviewed-on: https://gerrit.libreoffice.org/47736
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I7d89b011464ba5d2dd12e04d5fc9f65cb4daebde
|
|
This saves several megabytes of dirtied pages for each LOK
client of Online.
Change-Id: I425a2e7896879f0a64d71fcc0655e9e1fa1256aa
|
|
Change-Id: I539ca8b9dee5edc5fc2282a2b9b0ffd78bad8b11
|
|
I have kept the old mispelled constant for backwards compatibility
Change-Id: I128a2eec76d00cc5ef058cd6a0c35a7474d2411e
Reviewed-on: https://gerrit.libreoffice.org/39995
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
|
|
Change-Id: I73e945d6ec53537a0da45f6b6291018c7f251a7e
Reviewed-on: https://gerrit.libreoffice.org/39587
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: Iac7ca87e05228f3a2a187646496869a8b1bff602
Reviewed-on: https://gerrit.libreoffice.org/38436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
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>
|
|
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>
|
|
Change-Id: Ic96b64244f817196ccdfe06b97f7f31291adf372
|
|
The long-term benefit will be support of C++11 char16_t string literals (for
cases of string literals with non-ASCII content) once we drop any compilers that
don't support those yet. The short-term benefit is support for an improved
OUStringLiteral1 that accepts any sal_Unicode value, not just ASCII ones (see
next commit).
Change-Id: I3f8f6697d7eb62b5176b7e812b5a5113c53b83a4
Reviewed-on: https://gerrit.libreoffice.org/28445
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I6c656f991999791469015500aff1905fdb16ba65
|
|
...and fix its documentation, and use it throughout the code base.
Change-Id: I349bc2009b1b0aa7115ea90bc6ecd0a812f63698
|
|
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
|
|
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>
|
|
Change-Id: Ib34196185f90204a71598f2c659c3fddce7a0e4d
|
|
Change-Id: I745b09d8a248f08afdd3387f4cfcf69d71ec3c39
|
|
Change-Id: I5f525d91ce24d1d2653a6855f1c4fffc039ae398
|
|
Change-Id: Iec781bdbbf216cb14c9ba5be5955123273d7699c
|
|
Change-Id: I9fad024e4b5c8a4ca272f2387df07351198cf5dc
|
|
Change-Id: Ifc03631b126ec19cb98cb42a258ca4880e868385
|
|
Change-Id: I6e48e2593f93efd71e84a076a99457c3daf7d9e0
|
|
Change-Id: I0eccec058f506be69f6c95a1a6d97be64cb734bc
|
|
Change-Id: Ie9a37e7eb837abf0d2783a9a0f8c2b33a6772d33
|
|
Also remove some now redundant asserts from headers.
Some of these actually trigger on unit tests so are commented out.
Change-Id: I07c6b2b2bd175361691a141f22eec584e3ab8f0b
|
|
Change-Id: Ifd23373b1ac4919793d1b4251ed90cf2dd6f2bda
|
|
breaks windows build otherwise (fatal erro C1017)
Change-Id: Idae78c621bfb8f989eb33220f015e17a7b7fb92f
|
|
...and there is no reason for such a precond for rtl_string_newFromLiteral
Change-Id: I27f7217c8db17cef860c37886d0f7e561dc852f8
|
|
Change-Id: I9793f697f14118340bc6db89540fe50ad0b8ccbd
|
|
This addresses some cppcheck warnings.
Change-Id: Id5f90757571e76a2c05a4cbd37020e1f6a6b2033
Reviewed-on: https://gerrit.libreoffice.org/13544
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
|
|
Change-Id: I0d4f9b14f2a41a3acb08ba1b6c13fdf1174021e7
|
|
...because rtl_ImplGetFastUTF8UnicodeLen has already checked that.
Change-Id: I17f2b80f374073934a8f0b1a97099d4dec89ce4e
|
|
Keep the fast path fast, fall back to the text encoder in case there's a
fly in the ointment.
Change-Id: I94507856a7f3170f770adb741aa1e282d0d2400c
|
|
Change-Id: I0eae089be1bde9db822a77bea482c10650c8a137
|
|
...as flagged by -fsanitize=undefined. But is it really undefined?
[conv.double] "If the source value is between two adjacent destination values,
the result of the conversion is an implementation-defined choice of either of
those values." So if the double is between std::numeric_limits<float>::max()
and std::numeric_limits<float>::infinity()...
Change-Id: I6389c8ac4a922991e240638d231dd2a39e173882
|
|
...which did not work e.g. for broken single-byte input 0x80.
Change-Id: I4dff41e4f18dfce376695b438004c2af853cf4fa
|