summaryrefslogtreecommitdiff
path: root/include/rtl
AgeCommit message (Collapse)Author
2017-04-06Improved loplugin:redundantcast, static_cast on arithmetic types: salStephan Bergmann
Change-Id: I7caadbc06b2266800666151de75d799c42148aca
2017-04-04Finally switch MSVC to sal_Unicode = char16_t, tooStephan Bergmann
There is lots of (Windows-only) code that relied on sal_Unicode being the same as wchar_t, and the best change may be different in each case (and doing the changes may be somewhat error prone). So for now add SAL_U/SAL_W scaffolding functions to sal/types.h, remove their uses one by one again, and finally drop those functions again. Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea Reviewed-on: https://gerrit.libreoffice.org/36077 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-30remove type decorations on char literalsJochen Nitschke
they are only needed where type deduction fails. left them in defines for now. Change-Id: I7f002dd6bc7acc083c73b6c64076de6dd28d0b09 Reviewed-on: https://gerrit.libreoffice.org/35893 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-25Fix typosAndrea Gelmini
Change-Id: I998e9b2ad8ebdcc983239192cb61f6689e378ad9 Reviewed-on: https://gerrit.libreoffice.org/35633 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-24Better check for 'defined LIBO_INTERNAL_ONLY'Stephan Bergmann
(to avoid warnings about undefined macros in external code) Change-Id: Ie1007207b22c19a3d9d96f0f94070c32d417595a
2017-03-22Use rtl::isAscii* instead of ctype.h is* (and fix passing plain char)Stephan Bergmann
and add rtl::isAsciiWhiteSpace Change-Id: Iac71975f718b9360ea9dc94485c069c5e7cb91c7
2017-03-22Prevent calls to rtl/character.hxx functions with (signed) char argumentsStephan Bergmann
...that would implicitly be sign extended (for plain char only if it is signed), so non-ASCII char values would trigger the isUnicodeCodePoint assert. Change-Id: Iaf8024ad509e64525558e882fe3fd078cfb4ea91 Reviewed-on: https://gerrit.libreoffice.org/35523 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-21Mark rtl_locale_get/setDefault as deprecatedStephan Bergmann
unused in LO itself since 73bda5058bcef6be9a3185aa46375c7b147ffa22 "ditched rtl::OLocale" Change-Id: I6fd713f4771d7a7a397ef08002d1b9d754417f67
2017-03-21Only need an OStringBuffer in number2PolyPolygonStephan Bergmann
...so that later passing the OStringBuffer's aNum[i] to createSevenSegmentPolyPolygon (taking a first parameter of type char) doesn't need to implicitly convert from sal_Unicode to char. Requires addition of some missing OStringBuffer-related function variants in rtl/math.hxx and rtl/strbuf.hxx. Change-Id: I79e6b2a791abc62b6556a6668e4411cced490c11
2017-03-03Remove redundant 'inline' keywordStephan Bergmann
...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-03-03Fix typosAndrea Gelmini
Change-Id: I5e3c9683741ddc66283008c20794be5c2b2bc53f Reviewed-on: https://gerrit.libreoffice.org/34804 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-03Remove uses of SAL_CONSTEXPR in LIBO_INTERNAL_ONLYStephan Bergmann
Change-Id: I9a7dc7c83302b3361f056fcf6636bbba7672f15f Reviewed-on: https://gerrit.libreoffice.org/34840 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-10Remove MinGW supportStephan Bergmann
In OOo times, there'd originally been efforts to allow building on Windows with MinGW. Later, in LO times, this has been shifted to an attempt of cross- compiling for Windows on Linux. That attempt can be considered abandoned, and the relevant code rotting. Due to this heritage, there are now three kinds of MinGW-specific code in LO: * Code from the original OOo native Windows effort that is no longer relevant for the LO cross-compilation effort, but has never been removed properly. * Code from the original OOo native Windows effort that is re-purposed for the LO cross-compilation effort. * Code that has been added specifially for the LO cross-compilation effort. All three kinds of code are removed. (An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing --with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.) Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568 Reviewed-on: https://gerrit.libreoffice.org/34127 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26add 'explicit operator bool' to our reference classesNoel Grandin
Change-Id: I91cfbe2646dcc55b98d2b809c49c9ea073f54f58 Reviewed-on: https://gerrit.libreoffice.org/33517 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-09New loplugin:externvar: salStephan Bergmann
Change-Id: Iefc33784f21e7a0b88c8d6308618926e38ab8554
2017-01-09coverity#1371227 Missing move assignment operatorCaolán McNamara
Change-Id: I2de6b5e2910ff570c08e662769d5e6ee188825a7 Reviewed-on: https://gerrit.libreoffice.org/32843 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-05Replace side-effect--only uses of makeStringAndClear() with setLength(0)Stephan Bergmann
Change-Id: Iaf8011f1bd6a10b324653899b7f51458f7d0b68a
2016-12-17Make OUStringLiteral more usefulStephan Bergmann
...by: * making the OUStringLiteral ctor non-explicit (to be exploited in a follow-up commit) * adding (LIBO_INTERNAL_ONLY) overloads to OUString/OUStringBuffer functions that can now take OUStringLiteral in addition to taking "real" string literals (Keeping the number of overloads smaller by replacing the ConstCharArrayDetector overloads with ones taking OUStringLiteral (for LIBO_INTERNAL_ONLY, at least) and relying on the now-implicit conversion from "real" string literals to OUStringLiteral unfortunately would not work: Both OUString and OUStringLiteral argubably need implicit conversions from "real" string literals, so any function overloaded for OUString and OUStringLiteral would be ambinguous when called with a "real" string literal. And removing the OUString ctor taking a "real" string literal and relying on an implicit conversion chain from "real" string literal to OUStringLiteral to OUString doesn't work because it would involve two user- provided conversions.) Change-Id: I14433fc1605b048807f60b3a3e14f92221d3a226 Reviewed-on: https://gerrit.libreoffice.org/32097 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-16Typo in meant-to-be-overloading function nameStephan Bergmann
Change-Id: I65ab9176b39a436afce23e6bd4423ebf76219166
2016-10-31Revert "Revert "Prevent nonsensical comparations between OUString and ↵Stephan Bergmann
nullptr_t"" This reverts commit e559c0c9cbfd819f22ef695a9823bb71f4385b58; just turn the deleted overloads into non-friend functions (and rely on any other overloads to be still found via ADL). Change-Id: I2af834162cab2e71ed9e32ae6903bc9f86d77ba2 Reviewed-on: https://gerrit.libreoffice.org/30441 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-31Revert "Prevent nonsensical comparations between OUString and nullptr_t"Stephan Bergmann
This reverts commit 2e3f5c8dd3b21efe83269f603e26ac20f3adde64, some GCC have trouble with deleted friend functions; need to fix that properly.
2016-10-31Prevent nonsensical comparations between OUString and nullptr_tStephan Bergmann
...now that 1b98f38 css.xml.sax.XAttributeList is broken by design 074defe Strange OUString null check a24105a Nonsensical OUString null check 9799fe3 Nonsensical OUString null check d6b9fea Nonsensical OUString null check f2de7d0 This apparently always wanted to check that _rChars.trim() is non-empty a8cfc97 SvxBrushItem::GetGraphicLink no longer returns a pointer are fixed. (OString didn't have this problem with overloaded operator ==/!=, but had a similar issue with nullptr_t that OUString in turn didn't have, f20162304d73bc01955e9ef6506c3bd1c7016c48 "Rule out OString(std::nullptr_t)".) Change-Id: I4ca0e1f5a911448e7bc9b8c5dddff5993d61ef18
2016-10-12Don't allow O[U]StringBuffer in string concatenationStephan Bergmann
...as OStringBuffer b("foo"); b = "bar" + b; doesn't work as one might expect (see the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2016-October/075464.html> "concat of OUStringBuffer". That feature was LIBO_INTERNAL_ONLY, anyway. And of the affected places, MethodDescriptor::getSignature (codemaker/source/javamaker/javatype.cxx) was the only one that would actually have benefitted. Change-Id: Ib84266f43e40c42c2e428f0c0616db8cfa90adff
2016-10-07New rtl::splitSurrogates, remove code duplicationStephan Bergmann
Change-Id: Ic96b64244f817196ccdfe06b97f7f31291adf372
2016-10-04@since tag; sortingStephan Bergmann
follow-up to 2135eae2a97c17d89cb47a2074830fd2d7b2226f "let approxEqual() not scale too early for large representable integer values" Change-Id: I628e01297fea08915d0ca1c95f3ba13f7ce15db8
2016-10-01let approxEqual() not scale too early for large representable integer valuesEike Rathke
And since this is now too much code for inline move implementation to math.cxx Which again made it necessary to give libreofficekit lokdocview.cxx its own implementation that doesn't even claim to build against sal ... Change-Id: I0f80be9d9172ee20693b9babde715206f2c3d8c1 Reviewed-on: https://gerrit.libreoffice.org/29428 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2016-09-20Related cid#1371287: Work around missing OStringBuffer move semanticsStephan Bergmann
...by adding more assign op overloads instead Change-Id: I3686d6c29adc47b1a8c48be4260614fd53589c8b
2016-09-20Related cid#1371289: Work around missing OUStringBuffer move semanticsStephan Bergmann
...by adding more assign op overloads instead Change-Id: I2d2e1b7f19d1b57528707ed5a5cce94b5fa5c2d0
2016-08-30Let OUStringLiteral1 take its arg as ctor arg, not template argStephan Bergmann
...which makes it more flexible, can now also be used on non-const arguments. The drawback of the argument no longer being a compile-time constant is remedied by making the ctor constexpr. Change-Id: Ia4903a2cc86791fece92eac0cb8406b6659dd19d
2016-08-30tdf#99402: fix Metafile Font handlingMike Kaganski
1. For DEFAULT_CHARSET/OEM_CHARSET, use correct encoding based on LibreOffice Default Language for Documents setting (Tools->Options...->Language Settings->Languages). For that, two functions added to tencinfo.h, that map language names to corresponding Windows ANSI/OEM encodings. 2. If charset is DEFAULT_CHARSET/OEM_CHARSET for Symbol font, then always use RTL_TEXTENCODING_SYMBOL. Unit test is included. Change-Id: Ibff63e7a03dec42a9d2a74399936d6bc04f2ff1a Reviewed-on: https://gerrit.libreoffice.org/28322 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-08-29Make OUStringLiteral1 a wrapper around UTF-16 instead of just ASCIIStephan Bergmann
...not merely an ASCII character Change-Id: Id2b381b35fe3a15574728ed973d60263dfef7249 Reviewed-on: https://gerrit.libreoffice.org/28446 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-08-29Support ConstCharArrayDetector also for UTF-16 arraysStephan Bergmann
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>
2016-08-29OUString construction from OUStringLiteral1 must not be overruled by...Stephan Bergmann
...Except[Const]CharArrayDetector, under RTL_STRING_UNITTEST Change-Id: Ib185fb8406c4afcff1c854a2b74dae02a0ee2b3f Reviewed-on: https://gerrit.libreoffice.org/28444 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-06-14sal: rename O[U]String parameterMichael Stahl
Callgrind tinderbox complains that "string" shadows some global, so let's try "rString" instead. Change-Id: I3973f23ef6e8ebf861d66012fede84cb8a685be8
2016-05-13remove various crutches for boost::bind/boost::mem_fnMichael Stahl
These aren't used any more, and the C++11 std equivalents don't use get_pointer() overloads. Change-Id: Ib97a6a595863e21a1621c63709ea2b28f6550fde Reviewed-on: https://gerrit.libreoffice.org/24982 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-03-30loplugin:nullptr: Find some more cases in templatesStephan Bergmann
Change-Id: I1f127d56e40b04f2b4df85c0afbcfd424d68a8cc
2016-02-17Typo: namesapce(s)->namespace(s)Julien Nabet
Change-Id: Ic7c14c2e39a5ade1f5622a8350f9197d84cf9cc8
2016-02-15Rename rtl::isValidCodePoint -> rtl::isUnicodeCodePointStephan Bergmann
...and fix its documentation, and use it throughout the code base. Change-Id: I349bc2009b1b0aa7115ea90bc6ecd0a812f63698
2016-02-13tdf#81129 Support reading non-BMP characters in HTML documents.Mark Hung
1. Allow character entity ( &#nnnn; ) to exceed 0xffff in HTMLParser::ScanText() 2. Return a character as sal_uInt32 ( utf32 ) instead of sal_Unicode ( utf16 ) from SvParser::GetNextChar(). Conflicts: sw/qa/extras/htmlexport/htmlexport.cxx Change-Id: Ida455040970fae800f0f11471b27f53461fb78e4 Reviewed-on: https://gerrit.libreoffice.org/21152 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
2016-01-10Fix typosAndrea Gelmini
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86 Reviewed-on: https://gerrit.libreoffice.org/21209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-06tdf#39631 - branch hints: comment, and tweak variously, also use.Michael Meeks
Find a few million mis-predicted branches (according to callgrind) and annotate them. Mark string acquire/release as hot, and a number of deprecated methods as cold. Change-Id: I678b3981794221c97f9ebb70fd0161c0fda5dceb
2015-12-20sal: make OString/OUString immovable for MSVCMichael Stahl
Odd problem, with MSVC 2013 in CppunitTest_smoketest in sal/osl/w32/procimpl.cxx the read_environment calls std::stable_sort, which turns about 89 elements into the empty string since commit c9f6e12e7eb6a49389360626d206191147a174fb. No idea what the problem is but let's disable the move for now. Change-Id: I2912cd54a339bb6ab39922be516ea368a430f7c9 Reviewed-on: https://gerrit.libreoffice.org/20834 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-12-17OString/OUString: move constructors and operator=Noel Grandin
Change-Id: Icdc5f7137cca8360f116d5d4c7b0bf4a4c526e1d Reviewed-on: https://gerrit.libreoffice.org/20712 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-12-10More loplugin:nullptr automatic rewrite (within templates)Stephan Bergmann
Change-Id: I9bc06cfb5eeb38fd7ae7fb25f876ea9f96e4a65a
2015-11-28Adapt to true wchar_t in clang-clStephan Bergmann
Change-Id: I14c2dc0be12151b5d4ea2ba3b65030f6f4494905
2015-11-18Use C++11 char16_t for sal_UnicodeStephan Bergmann
...in LIBO_INTERNAL_ONLY, __cplusplus, non-MSVC case. It turns out that sal_Unicode happens to not be mangled into any symbols that make up the stable URE interface, so (for LIBO_INTERNAL_ONLY, at least) we are free to replace the typedef to sal_uInt16 with a typedef to any integral type layout-compatible with that. (sal_Unicode does appear in some symbols in sal's PRIVATE_textenc.1 section, but that is private between the sal and sal_textenc libraries, so changing those symbols does not require a change of SONAME.) C++11 chart16_t is the obvious choice (and will ultimately allow using u"..." to write literals of type array-of-sal_Unicode). Reportedly, char16_t is supported since GCC 4.4 and Clang 2.9 but will only be available in MSVC 2015. For plain C, we continue to use sal_uInt16. We could theoretically use C11 char16_t from <uchar.h>, but at least the Mac OS X 10.11 SDK still does not offer that C11 header. For MSVC, we continue to use wchar_t (which is actually unsigned short, due to /Zc:wchar_t-) for now. Potential options there include dropping /Zc:wchar_t- and using true wchar_t, or using C++11 char16_t once support for MSVC 2013 is dropped. Some code needed to be adapted that was written in a way assuming that sal_Unicode is unsigned short (which indicates that changing sal_Unicode for non-LIBO_INTERNAL_ONLY would be an ABI change). OUStringBuffer::append can now differentiate between being called with sal_Unicode (to append a single character) and erroneously being called with sal_uInt16 (intending to append a number's textual representation, for which the sal_Int32 overload must be used instead). Bugs found are 379fe0409e7973b36210cffa3dd1dfd4032f0ecc "Assume that this code wants to append a number, not a character" and dc148335a6a438848325f24c49198fba81043279 "Assume this wants to append the numerical representation." The GDB support for pretty-printing of sal_Unicode-related data in solenv/gdb/libreoffice/sal.py can presumably be simplified now. Change-Id: I445b3a80e65b7cb004d9e08b38bdc9ee93bc9401 Reviewed-on: https://gerrit.libreoffice.org/20036 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2015-11-13Adapt to clang-clStephan Bergmann
Change-Id: I2f79e52da2aa0ad3a37aac07a36dbe14dfe401a9
2015-11-13-Werror,-Wmicrosoft-enum-valueStephan Bergmann
Change-Id: Iafd6e5f899835303e421be923f70d1e3f42bf65e
2015-11-10Missing includes (for NULL)Stephan Bergmann
Change-Id: Id2359f6ff4bddb2afbc0b346e17cd858f00179e3
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8