Commit Graph
119 Commits
Author SHA1 Message Date
Stephan Bergmann e05263e0f2 Change INetURLObject::isSchemeEqualTo parameter to u16string_view
Change-Id: I003fa0c6f9c485d0579f3dd18331e63548a3777c
Reviewed-on: https://gerrit.libreoffice.org/50728
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-03-04 16:13:15 +01:00
Stephan Bergmann 8456c2ba40 More loplugin:cstylecast: tools
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: Ifb9ebc9623c8df14ea0d4c907001bd16c5b9ae59
2018-01-12 20:13:01 +01:00
Noel Grandin adf0738d2d long->sal_Int32 in BigInt
And fix an issue discovered in the PPT parsing, where one of the
test files has dodgy values that trigger the assert in
BigInt::operator long().

Change-Id: Ic324ac38ecef4153cc434376317643ababe0a537
Reviewed-on: https://gerrit.libreoffice.org/47314
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-05 10:41:53 +01:00
Stephan Bergmann 022e64e838 loplugin:includeform: tools
Change-Id: I0af695964e467022050500293570c1e01ac4a517
2017-10-23 22:45:49 +02:00
Noel Grandin d3971ec256 new loplugin:blockblock
Change-Id: I7b68b70fa4c7234e8882f7627026959a596968fd
Reviewed-on: https://gerrit.libreoffice.org/43025
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-03 08:41:11 +02:00
Andrea Gelmini 894115b573 Fix typos
Change-Id: I78653129638b25f16e0816b6fff11e02100c85e7
Reviewed-on: https://gerrit.libreoffice.org/42321
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2017-09-15 20:33:52 +02:00
Stephan Bergmann 186e316896 Assert flags passed to rtl_convertTextToUnicode/UnicodeToText are valid
...so that at least some typos of using OUSTRING_TO_OSTRING_CVTFLAGS (0x566)
instead of OSTRING_TO_OUSTRING_CVTFLAGS (0x333) can be found.  (Unfortunately,
in the other direction, 0x333 is a valid combination of
RTL_UNICODETOTEXT_FLAGS_*.)

Change-Id: I7cfb3677b103ae90de88833cc93b0a5384607e15
Reviewed-on: https://gerrit.libreoffice.org/42288
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-15 14:31:42 +02:00
Noel Grandin 331e2e5ed3 long->sal_Int32 in Fraction
because long is 32bits on Windows and 64bits on Linux.

Reasoning:
(a) all the users of Fraction used to be 32bit in the past
(b) this makes the Linux code behave the same as the Windows code
(c) changing it to 64bits would be dangerous because then call sites
could see silent truncation.

Change-Id: I2a36200623a3cf2e7d62ccad030a20614e1798fb
Reviewed-on: https://gerrit.libreoffice.org/42200
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-15 09:53:57 +02:00
Noel Grandin 9881bea8d4 remove unnecessary use of OUString::getStr
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4
Reviewed-on: https://gerrit.libreoffice.org/38114
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17 11:55:13 +02:00
Eike Rathke fcd0361d6b Eliminate Date::operator+=() and -=() and replace with Date::AddDays()
Clarifies code and gets rid of explicitly casting the operand to sal_Int32.

Also in preparation of removing DateTime::operator+=(sal_Int32) that is
confusingly similar to DateTime::operator+=(double) and just depends on type.

Change-Id: I83422e2940fbb017978db9b5734b4966228af3de
Reviewed-on: https://gerrit.libreoffice.org/40248
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-07-21 12:24:27 +02:00
Noel Grandin f5b0cc2a36 use sal_Int32 in tools::Date
instead of long, which has platform-dependant length
(32bits on windows, 64bit on everything else)

Change-Id: I9b5a950f56dad99a016b481c221bfd103ffa3911
Reviewed-on: https://gerrit.libreoffice.org/39433
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-03 08:41:29 +02:00
Noel Grandin ef531e85d9 loplugin:oncevar in test..tools
Change-Id: I7b3ccc8f227100ff7fedeaca96a12f135da60bab
Reviewed-on: https://gerrit.libreoffice.org/39326
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-28 08:54:42 +02:00
Andrea Gelmini a940826162 Fix typos
To complete commit 0ef94e2b55
and f12096272e

Change-Id: Ie86bbfbd58dd728a013bef221e4d5c8fbcaf8e03
Reviewed-on: https://gerrit.libreoffice.org/37199
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-05-05 23:35:06 +02:00
Arnaud Versini 1fdb0e1897 Replace all OUString("") with OUString()
Change-Id: Ie14c4d76cb61cfbe0410103adfc1afc8ade0f3e0
Reviewed-on: https://gerrit.libreoffice.org/37146
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-04 08:39:18 +02:00
Eike Rathke 4c6876582d Add more unit tests for Date::Normalize()
Change-Id: I013317bfa9dad02194177cca0907b0ffbb171ccd
2017-05-02 21:12:11 +02:00
Eike Rathke 246a2a5466 Test that empty date is not a valid date
Change-Id: If5f2db3d4bae9158b482b01ce7dbb7335b4cb16b
2017-05-02 21:12:11 +02:00
Jochen Nitschke 8250e1a4a3 use std container for ParameterList
'ParameterList::find' was used to detect duplicate sections and
sort the parameters by attribute and section.
Checking for duplicates is done by 'std::any_of' and
the predicate 'Parameter::IsSameSection' now.
The parameters are inserted as they are parsed and sorted later
with 'std::sort' algorithm and 'Parameter::operator<'

Adapt loops to use iterators. Change a weird 'for' loop in
'parseParameters' to a 'do .. while ..' loop to match style of a
preceding loop.

Extend unit test with a case of duplicate sections.

Change-Id: If2789c0cee8f64deae84bc720807d2d26d81dc9f
Reviewed-on: https://gerrit.libreoffice.org/37075
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-28 22:29:45 +02:00
Eike Rathke 8bdbfdb97d Add unit tests for Date::Normalize()
Change-Id: I4edb04748b1f407eb6ce17cd24ff022cef6e1f67
2017-04-28 17:22:06 +02:00
Stephan Bergmann 50413b07d2 loplugin:cppunitassertequals: tools
Change-Id: I8dc45fbbe3ea8c3fb898250e55cee582d1d8199d
2017-04-28 14:22:41 +02:00
Jochen Nitschke bef9fe6e3d extend unit test for INetMIME::scanContentType
This reverts parts of commit 631b679529
and commit abc6071b7a.

some of the removed fields are usefull,
m_bConverted should be checked by callers

fixed 2 bugs and added test cases:
* extended attributes with more than 2 sections were not parsed
* extended attributes with more than 1 section were not parsed
  if there was an other attribute

Change-Id: I61ab2af7c5151ef1bcd80cc159fa2b99559374a8
Reviewed-on: https://gerrit.libreoffice.org/36913
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-04-26 09:16:19 +02:00
Chris Sherlock da64d198ec tools: svstream.hxx needs only errcode.hxx & not errinf.hxx
Change-Id: Ia28e35ae5af4f601e9a586a3deffbcd61702b0ca
Reviewed-on: https://gerrit.libreoffice.org/36896
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-04-25 09:31:31 +02:00
Stephan Bergmann c4d02f488d Add minimal INetMIME::scanContentType test and fix bugs thus found
Change-Id: I8fcbeb2b0804bc4f9ee8f97f7d02737ba79a7f20
2017-04-12 13:39:52 +02:00
Miklos Vajna a5a571307f tdf#82580 tools: rename Rectangle to tools::Rectangle
Mostly generated using

make check COMPILER_EXTERNAL_TOOL=1 CCACHE_PREFIX=clang-rename-wrapper RENAME_ARGS="-qualified-name=Rectangle -new-name=tools::Rectangle"

Except some modules have their own foo::tools namespace, so there have
to use ::tools::Rectangle. This commit just moves the class from the
global namespace, it does not update pre/postwin.h yet.

Change-Id: I42b2de3c6f769fcf28cfe086f98eb31e42a305f2
Reviewed-on: https://gerrit.libreoffice.org/35923
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2017-03-31 06:27:11 +00:00
Stephan Bergmann 635d4b0eb8 Clarify some INetURLObject::setExtension behavior
Change-Id: I1a9e7233b2861a3d09661a08c07d2043c9c0c3c1
2017-01-24 10:07:31 +01:00
Miklos Vajna a0ab0c79fd CppunitTest_tools_test: fix loplugin:cppunitassertequals warnings
Change-Id: I6738b6b5159403f1654b401a27f08fc829521e73
2016-12-09 12:07:19 +01:00
Noel Grandin 50151db9f7 convert FSysStyle to o3tl::typed_flags
Change-Id: I58a63a0e6f619442f21827064644ecd8ca57b8ff
2016-12-05 12:49:02 +02:00
Noel Grandin bfde4866e0 convert DecodeMechanism to scoped enum
Change-Id: I5c56634b1bca8e37fa73d02d2428645301b6c547
2016-12-05 12:49:02 +02:00
Stephan Bergmann 613213240a clang-cl loplugin: tools
Change-Id: I6f02d9607405e144727f925c8f8a1de6041688b9
Reviewed-on: https://gerrit.libreoffice.org/29844
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-15 07:59:10 +00:00
Michael Stahl b647996a9b replace sal_Size with std::size_t (or sal_uInt64 for SvStream pos)
... except in include/rtl, include/sal, include/uno, where sal_Size is
retained for compatibility, and where callers of rtl functions pass in
pointers that are incompatible on MSVC.

Change-Id: I8344453780689f5120ba0870e44965b6d292450c
2016-09-15 12:01:11 +02:00
Eike Rathke 6d4f2dcc7c Resolves: tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar
... implementing signed years with year 0 gap.
Date(31,12,-1) last day BCE
Date(1,1,1) first day CE

New class Date member functions:
* AddYears(sal_Int16) to be used instead of
  aDate.SetYear(aDate.GetYear()+sal_Int16) to handle year 0 gap.
* convenience GetNextYear() to be used insted of GetYear()+1
* convenience GetPrevYear() to be used insted of GetYear()-1
* AddMonths(sal_Int32)
* operator=(const css::util::Date&)

New class DateTime member functions:
* operator=(const css::util::DateTime&)

Made some conversion ctors explicit, specifically Date(sal_Int32)

Adapted hopefully all places that used a sal_uInt16 year to use
sal_Int16 where appropriate.

Eliminated some quirks in date handling found on the fly.

Added era handling to i18npool icu calendar setting interface, which
missing was responsible for 0001-01-01 entered in Calc being set as
-0001-01-01, hence subtracting one day resulted in -0002-12-31.

Change-Id: I77b39fba9599ebd5067d7864f6c9ebe01f6f578f
Reviewed-on: https://gerrit.libreoffice.org/27049
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-08 20:41:02 +00:00
Michael Stahl 62d270116b tools: rename SvStream::Read/Write to ReadBytes/WriteBytes
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a
Reviewed-on: https://gerrit.libreoffice.org/25972
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-06-06 18:09:11 +00:00
Chirag Manwani cc84aaf70a tdf#97703 removed empty setUp/tearDown methods
Change-Id: I244d481bce4723d172e26c0d31aab0a541334604
Reviewed-on: https://gerrit.libreoffice.org/22959
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-03-07 09:13:53 +00:00
Noel Grandin 2087484c65 use consistent #define checks for the Windows platform
stage 2 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

In this stage we focus on replacing usage of the WIN macro

Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84
Reviewed-on: https://gerrit.libreoffice.org/22393
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17 11:33:57 +00:00
Noel Grandin ce43d0ae92 use consistent #define checks for the Windows platform
stage 1 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

Change-Id: Iece73abdee530937e0737190b1aa97a46cd3075f
Reviewed-on: https://gerrit.libreoffice.org/22390
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-02-16 10:37:55 +00:00
Chris Sherlock a238b1f8d3 Remove excess newlines
A ridiculously fast way of doing this is:

for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \
  --exclude-dir=workdir --exclude-dir=instdir '^
{3,}' .)
do
    perl -0777 -i -pe 's/^
{3,}/

/gm' $i
done

Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c
Reviewed-on: https://gerrit.libreoffice.org/22224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-09 08:18:05 +00:00
Noel Grandin b14224fe97 loplugin:unusedmethods
using an idea from dtardon:

<dtardon> noelgrandin, hi. could you try to run the unusedmethods clang
plugin with "make build-nocheck"? that would catch functions that are
only used in tests. e.g., i just removed the whole o3tl::range class,
which has not been used in many years, but htere was a test for it...
<noelgrandin> dtardon, interesting idea! Sure, I can do that.

Change-Id: I5653953a426a2186a1e43017212d87ffce520387
Reviewed-on: https://gerrit.libreoffice.org/22041
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-08 06:08:14 +00:00
Stephan Bergmann 1c4f33b5d8 loplugin:nullptr (automatic rewrite)
Change-Id: Ia5acfb564f913d52cd25b5d64d06b5280b94cb72
2015-11-10 10:31:54 +01:00
Stephan Bergmann e01e03ae6d loplugin:stringconstant: elide explicit ctor usage (automatic rewrite)
Change-Id: I88a3396746bf12c08265600072a368c9bbf5744e
2015-11-06 09:38:10 +01:00
Matteo Casalin 7e89e28274 sal_uIntPtr to sal_uInt64, sal_uLong to sal_Size for streams
Change-Id: I062f1f6c5b20ca47734a9a3cd1a229d51763a206
2015-10-27 13:59:09 +01:00
Stephan Bergmann b36963c0a6 Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY code
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-10-12 17:52:29 +02:00
Giuseppe Castagno 8ea85c264f Add isSchemeEqualTo(), isAnyKnownWebDAVScheme() to INetURLObject
...which will be used when rebasing
    <https://gerrit.libreoffice.org/#/c/17189>
"tdf#82744: fix WebDAV lock/unlock behaviour - part 3" on top of
 d3de490437
 "Add vnd.sun.star.webdavs URL scheme."

Change-Id: I19bd715d755a6f070b95ce897d8a1bbb4910d537
Reviewed-on: https://gerrit.libreoffice.org/18151
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2015-10-05 11:11:24 +00:00
Stephan Bergmann 984780243c HEADER_FIELD_TEXT is the only used HeaderFieldType
Change-Id: Ia4e5554e1aaed9e821bdea18b9b3acff001dd6e7
2015-09-17 22:19:23 +02:00
Tomaž Vajngerl 36d0f7795c disable an assert in color tests due to rounding error
Change-Id: I829cb4dd2d256a621a407b7715ffc12e90a939b6
2015-09-03 12:20:00 +09:00
Tomaž Vajngerl 1249262e97 Change color test to report expected values when assert fails
Change-Id: I8383dd317a4f8af5f057d81d8e90172b1f78edde
2015-09-03 09:38:51 +09:00
Tomaž Vajngerl eb2e1ab465 Report reference color and expected color if test fails
Change-Id: I7c8110b31171b247bcd46cee02f41972f59cbdcc
2015-09-03 08:50:52 +09:00
Noel Grandin 43691a15b3 tdf#93794 - spin buttons not rendered in gtk2/gtk3
for penance, introduce a unit test

Change-Id: I2c40285732be665e179c477e6e7603aa6f8be5d7
2015-08-31 13:59:55 +02:00
Stephan Bergmann cce0620a06 loplugin:passstuffbyref
Change-Id: I0244f12f1ee2e61ac577222a14b011aee5ddbd54
2015-08-27 08:01:52 +02:00
Tomaž Vajngerl a0ab7c31a2 Again add ability to change tint/shade of a color + unit test
Change-Id: I4c06290f09e5bfecd2c1de896e19cb5036a3a0e9
2015-08-27 08:30:49 +09:00
Tomaž Vajngerl 9125549453 add some unit tests for tools::Rectangle
Change-Id: Ic0323864455c248c926e69a0bb91d13adc963eca
2015-07-09 10:09:16 +09:00
Noel Grandin d3d4b86919 loplugin:unusedmethods tools
Change-Id: I45f5489233879126d4f9ee3d01db504d950bb597
Reviewed-on: https://gerrit.libreoffice.org/16656
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-02 06:37:53 +00:00