Commit Graph

27 Commits

Author SHA1 Message Date
Stephan Bergmann
598d8194b0 Visible function type RTTI for Clang -fsanitize=function
...by adding some further SAL_DLLPUBLIC_RTTI type annotations (cf.
b4f6b26b5a "SAL_DLLPUBLIC_RTTI for proper RTTI
visibility for LLVM") and by making sure relevant function types do not use
incomplete types in their parameter and return types (which would make the RTTI
hidden).

Change-Id: Id7aadcbc0704b9759968ae36266fc9ce11a2e340
2015-01-26 15:17:28 +01:00
Caolán McNamara
c6686fee44 remove boost::unordered_* from comments
seeing as config.h has just changed

Change-Id: Ia4b78ec4c2522a1b5d6beb1f713855b654234a24
2015-01-07 13:46:01 +00:00
Stephan Bergmann
a5bdf3c606 Make O[U]StringLiteral ctor explicit
Change-Id: Ide8b167d544447dd6844f5249fe6831ef4d2b4eb
2014-12-19 14:28:14 +01:00
Stephan Bergmann
240f9bcb70 No need for RTL_FAST_STRING in addition to LIBO_INTERNAL_ONLY
Change-Id: I5514898f588b21bafceefca95e3276826cb9a882
2014-12-19 14:28:14 +01:00
Stephan Bergmann
d5c86be04e No need for RTL_USING in addition to LIBO_INTERNAL_ONLY
Change-Id: Iaa65658aed6bb4abb20a4d95dc9c6caf7c1c764b
2014-12-19 14:28:13 +01:00
Michael Stahl
6a0fe37dec sal: clean up public headers with include-what-you-use
Sadly cannot forward declare "struct {...} TimeValue;".

rtl/(u)?string.hxx still include sal/log.hxx but removing osl/diagnose.h
was painful enough for now...

Change-Id: Id41e17f3870c4f24c53ce7b11f2c40a3d14d1f05
2014-11-17 11:06:53 +01:00
Brij Mohan Lal Srivastava
d32be3ace8 fdo#86023 - O[U]String needs a 'clear' method
Added clear() method to OString and OUString class, Updated appropriate call-sites.

Change-Id: I0ba97fa6dc7af3e31b605953089a4e8e9c3e61ac
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-11-14 09:20:38 +01:00
Tor Lillqvist
ab740f43d0 'internal' is a keyword in current C++/CLI
Using it as a namespace in our rtl string headers breaks compilation
of cli_ure/source/climaker/climaker_emit.cxx (and other C++/CLI
sources we might have that include rtl string headers). Rename it to
'libreoffice_internal'.

Change-Id: Ieae68bd612b05d326d570945c1d08a54bf011852
2014-07-08 02:37:36 +03:00
Noel Grandin
e5c20a785c sal/rtl: remove SAL_THROW macro
Change-Id: I70e41f087dbe188f8fc455150480faeae2b426ed
2014-06-05 08:17:48 +02:00
Stephan Bergmann
042725a5da Stick to a single O[U]String hash function
8f8bc0dcf3 "Move string hash function into String
class" had introduced a new getHash64 that, besides returning sal_uInt64 instead
of just sal_Int32, didn't do sampling of only a handful of characters, but
always computed the hash over all characters (as the usage in SfxItemSet and
SdPage appears to require for either performance or approximated correctness).

However, it would be advantageous to keep the stable URE interface as small as
possible.  Now, O(1) sampling was apparently considered state of the art when
the rtl string classes were first created, closely copying java.lang.String,
which at that time demanded sampling for hashCode(), too---but never sampling
more than 15 characters, with the obvious (in hindsight, at least) performance
catastrophes, so they changed it to O(n) somewhere along the way.

Based on that, this commit changes the existing hash functions to not do
sampling any more, and removes the newly introduced -64 variants again.  (Where
the extended value range of sal_uInt64 compared to sal_Int32 was hopefully not
vital to the existing uses.)

The old implementation used sampling only for strings of length >= 256, so I did
a "make check" build with an instrumented hash function that flagged all uses
with inputs of length >= 256, and grepped workdir/{Cppunit,Junit,Python}Test for
hits.  Of the 2849 hits encountered, 2845 where in the range from 256 to 295
characters, and only the remaining four where of 2472 characters.  Those four
were from CppunitTest_sc_subsequent_filters_test, importing long text into a
cell, causing ScDocumentImport::setStringCell to call
svl::SharedStringPool::intern, which internally uses an unordered_set.  These
results appear to justify the change.

Change-Id: I78fcc3b0f07389bdf36a21701b95a1ff0a0d970f
2014-02-18 13:08:58 +01:00
Muthu Subramanian
4cf0d8edaf String cleanups.
Change-Id: Ibebf394d69ed4845d91176727f291187ba35ed34
2014-02-17 19:17:20 +05:30
Muthu Subramanian
8f8bc0dcf3 Move string hash function into String class.
hashCode() seems to do sampling while creating the hash.
hashCode64() will not.

Change-Id: Id30f5a2a774cf5244dbc00da9649e95a532484be
2014-02-13 13:13:53 +05:30
Stephan Bergmann
e3133ae237 Let C++ inline functions return bool instead of sal_Bool
...to improve diagnosing misuses of boolean expressions in client code (cf.
compilerplugins/clang/implicitboolconversion.cxx).  This change should be
transparent to client code.

Missing overloads of insert() for bool have been added to OStringBuffer and
OUStringBuffer (which required dropping one !VALID_CONVERSION check that would
now pick that overload, but would be flagged by
compilerplugins/clang/pointertobool.cxx).

Change-Id: I2d64cd923b8f47bfaa31e753def6515c29a3f8c9
2014-01-23 18:43:53 +01:00
Andres Gomez
39f14fc001 rtl: starts-/endsWith* new second parameter since 4.2
Updated the documentation for the new optional second parameter in the
O(U)String startsWith* and endsWith* methods so it is explicitly said
that it is only available since LibreOffice 4.2

Change-Id: I58758e4bae85eef07c578dd50d6e0279b49deaf5
Reviewed-on: https://gerrit.libreoffice.org/6649
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2013-11-12 13:10:01 +00:00
Norbert Thiebaud
1b9742b7d7 fdo#65108 inter-module includes <> include/rtl
Change-Id: Ic90a365a237aa23846f97131146a5aa2c46b5fd2
2013-11-09 18:48:41 -06:00
Michael Stahl
7a273a59f7 OUString::operator[] silence -Werror=strict-overflow warnings
GCC 4.8.2 warns when index is a subtraction expression; the real
problems in that case will be found by the "index >= 0" check.

Change-Id: Iac2796badf88b7bdf6c273ddb800a8af0d3eaa6a
2013-11-07 01:34:35 +01:00
Michael Stahl
b5aa7f71e6 OString::operator[]: make this consistent with OUString
Change-Id: If63362aba058bbcc0cc6bb1fae1c76005f1291d4
2013-11-07 01:34:35 +01:00
Thomas Arnhold
1130a359cb fixincludeguards.sh: include - the rest
Change-Id: If1ee11da444a7f96f2d8668b277540da0bb4dbe9
2013-10-23 23:22:31 +02:00
Stephan Bergmann
57af2ee947 Allow starts-/endsWith* to also return the rest of the matched string
...as there are many cases where the code later wants to obtain this part, and
esp. for the string literal variants it is awkward to calculate the length of
the literal again if this is coded with a following copy() call.  Adapt some
code to use this new feature.

(Strictly speaking, the @since tags for the---backwards-compatibly---modified
functions are no longer accurate of course.  Also, clean up some sal_Bool and
SAL_THROWS(()) that are unnecesssary cargo-cult here, and where the clean-up
should have no practical compatibility consequences.)

Change-Id: I43e5c578c8c4b44cb47fd08f170b5c69322ad641
2013-10-15 22:52:26 +02:00
Luboš Luňák
64b993e046 finish deprecation of O(U)String::valueOf()
Compiler plugin to replace with matching number(), boolean() or OUString ctor,
ran it, few manual tweaks, mark as really deprecated.

Change-Id: I4a79bdbcf4c460d21e73b635d2bd3725c22876b2
2013-08-21 15:10:35 +02:00
Stephan Bergmann
c38592527a EXCEPTIONS_OFF is never defined
...since gb_LinkTarget_NOEXCEPTIONFLAGS became unused with
e81b1f23c4 "remove
gb_LinkTarget_add_noexception_object."

Change-Id: I4a7275b5b26a9d4b6ded66efb52e6866e6e09cc3
2013-08-14 13:29:39 +02:00
Stephan Bergmann
3af0114a29 Introduce O[U]String::toUInt32
...which has become necessary since bd60d41176
"Handle oveflow in O(U)String::toInt() functions" reduces values in the range
(SAL_MAX_INT32 .. SAL_MAX_UINT32] to zero, but some calls of toInt32(16) relied
on getting a correct (unsigned) value for the whole input range ["0" ..
"FFFFFFFF"] (see libreoffice-4-1 commit 9bf6c83367cedb7be81bf67f30d2147d26c7a8c3
"Revert overflow checks in O[U]String::toInt{32,64} again").

Audited all uses of toInt32/64 with non-decimal radix.  (There is still a TODO
comment in oox/source/helper/attributelist.cxx, and
stoc/source/typeconv/convert.cxx will still need some love and test code.)

Change-Id: Iadaca1c0e41dab553687d0ce41c20c10cd657a95
2013-06-13 17:08:36 +02:00
Stephan Bergmann
8c3657658a Tweak comments
(Preventing documentation of macros via @cond ... @endcond is apparently at
least broken in Doxygen 1.8.3 and working in Doxygen 1.8.4.)

Change-Id: I2ee582119dba2c3d27db5298786d3076921af46d
2013-05-29 15:03:01 +02:00
Stephan Bergmann
d080e70af3 Remove redundant (private) DO_NOT_ACQUIRE
...the constructors with SAL_NO_ACQUIRE argument do the same.

Change-Id: I5c893080c9ae14e9e7ecefb726f3d99fce67ec81
2013-05-23 08:49:24 +02:00
Tor Lillqvist
cb6d67c21f Spelling "separate" (etc) correctly is hard 2013-05-15 11:14:28 +03:00
Herbert Dürr
1857688e1f Resolves: #i122208# introduce rtl::CStringHash and rtl::CStringEqual
unify the various c-string compares and hashes.

(cherry picked from commit b7e3470a154538a92f0a21b14e726d75723f4a92)

Conflicts:
	oox/inc/oox/export/shapes.hxx
	oox/source/export/shapes.cxx
	sal/inc/rtl/string.hxx
	sdext/source/minimizer/pppoptimizertoken.cxx
	svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
	vcl/source/glyphs/gcach_ftyp.cxx
	writerfilter/source/resourcemodel/TagLogger.cxx
	xmloff/source/draw/EnhancedCustomShapeToken.cxx

Change-Id: Ib742744077bfb4d38a462d88b44bdef45601b4ae
2013-05-10 12:36:33 +01:00
David Tardon
6c7659b584 move URE headers to include/
Change-Id: Ib48a12e902f2311c295b2007f08f44dee28f431d
Reviewed-on: https://gerrit.libreoffice.org/3499
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2013-04-24 05:17:10 +00:00