summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2018-09-18loplugin:useuniqueptr in convertToUnicodeNoel Grandin1-24/+20
Change-Id: I1d4379350793c3c245952793af5defeea84075b3 Reviewed-on: https://gerrit.libreoffice.org/60624 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann1-2/+2
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-12loplugin:simplifyconstruct in toolkit..ucbNoel Grandin2-4/+1
Change-Id: Ica3efbdbf05a8161861b8be1ccdc62ab4aec1d69 Reviewed-on: https://gerrit.libreoffice.org/60371 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-06clang-tidy performance-unnecessary-value-paramNoel Grandin1-1/+1
Change-Id: I69247498e13331f6ef84afeb242479f8fb1178a8 Reviewed-on: https://gerrit.libreoffice.org/60068 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-03Missing includeStephan Bergmann1-0/+2
Change-Id: Ib04de3f3f143cfa8a0c9d6171e329655d96527eb
2018-08-31Do as the comment says it should do..Eike Rathke1-1/+1
stupid me.. Change-Id: I5cd067a653641bb86e0a76f86f334781dbaef018 Reviewed-on: https://gerrit.libreoffice.org/59875 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-31The never ending rounding and scaling of tools::Time::GetClock()Eike Rathke1-3/+16
Change-Id: Idab1c49730e10a806d7aeecb1d9b2676b3cc51e5 Reviewed-on: https://gerrit.libreoffice.org/59839 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-29Round fraction if possible, else truncate; tools::Time::GetClock()Eike Rathke2-9/+35
With this also some test cases can be narrowed. Change-Id: Ic754baf135dbd362b80fac1cf080758f46017e01 Reviewed-on: https://gerrit.libreoffice.org/59753 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-29Add unit tests for tools::Time::GetClock()Eike Rathke1-0/+88
Change-Id: I0ff755fca2ee193f0f7ad99499ea12000029e674 Reviewed-on: https://gerrit.libreoffice.org/59736 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-08-28Assign fFractionOfSecond in shortcutEike Rathke1-0/+1
Otherwise it may be uninitialized. Change-Id: Iccb61d66c8410ac8ecdabbd96204d2393060bc1d Reviewed-on: https://gerrit.libreoffice.org/59721 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-28Move lcl_getHourMinuteSecond() to tools::Time::GetClock()Eike Rathke1-0/+51
Also add fFractionOfSecond and nFractionDecimals to obtain the remaining fraction of second. In preparation to use this in the number formatter and other places that obtain the wall clock time particles, which likely so far use bad rounding as well. Change-Id: I4fbea4165c560646438b06c340756c97dafa7c78 Reviewed-on: https://gerrit.libreoffice.org/59700 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-21tdf#119326 crash when adding "Windows Share" File resourceNoel Grandin2-39/+0
this was a regression from commit ce43d0ae9279edbf1ad108fe0d8325327a038d49 use consistent #define checks for the Windows platform where I converted #ifdef WIN to #ifdef _WIN32 But that was already dead code at that point since we did not define that preprocessor constant anywhere. Change-Id: Ieadafd61fada05fc19d04d83992fba7c42969daa Reviewed-on: https://gerrit.libreoffice.org/59402 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-16remove mempoolNoel Grandin2-53/+0
we've been using the normal memory allocator instead of the sal slab allocator ever since commit bc6a5d8e79e7d0e7d75ac107aa8e6aa275e434e9 Date: Wed Nov 15 16:52:44 2017 +0530 Disable custom allocator Change-Id: I3383962cedb85d56fbec695398901f6ff7057651 Reviewed-on: https://gerrit.libreoffice.org/58577 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-04Use more basegfx deg<->rad functions, instead of direct formulasMike Kaganski1-3/+3
Also make the functions constexpr. Due to slight changes in floating-point arithmetics (90.0 instead of 180.0, M_PI2 instead of M_PI resp.), results might differ in last digits (usually 17th decimal digit). This has lead to need to tweak char2dump's PieChartTest unit test. Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3 Reviewed-on: https://gerrit.libreoffice.org/58583 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-08-02Add missing sal/log.hxx headersGabor Kelemen2-0/+2
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from test to vbahelper Change-Id: Ia7f773511624099505d6a36a8d6e23c0cde4a737 Reviewed-on: https://gerrit.libreoffice.org/58225 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-30make DBG_TESTSOLARMUTEX available in assert buildsNoel Grandin1-1/+1
where our QA people are more likely to trigger it Change-Id: I4ce7c8c72e7e21f2296c0f9cc9f019aaef32ed0b Reviewed-on: https://gerrit.libreoffice.org/58170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-29cppcheck: useInitializationList in test to xmloffJochen Nitschke2-4/+3
Change-Id: I50545784c5412ab7767f401c6e40058a1d0bfab0 Reviewed-on: https://gerrit.libreoffice.org/58262 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-27new loplugin:stringloop, and applied in variousNoel Grandin1-17/+18
look for OUString being appended to in a loop, better to use OUStringBuffer to accumulate the results. Change-Id: Ia36e06e2781a7c546ce9cbad62727aa4c5f10c4b Reviewed-on: https://gerrit.libreoffice.org/58092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-26-Werror,-Wunused-private-fieldStephan Bergmann1-1/+0
...since ee025b744ac9efafe7c083ed80f8e2cc7cb3e2c1 "loplugin:returnconstant in tools,comphelper,unotools" Change-Id: Ia5fb60f5929084d8e3c6f45d81eefa55da100954
2018-07-26loplugin:returnconstant in tools,comphelper,unotoolsNoel Grandin3-9/+5
Change-Id: Iabc3c67b4cdcd0344a37c533bf92dd00cd4700d8 Reviewed-on: https://gerrit.libreoffice.org/57974 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-18Fix typosAndrea Gelmini1-1/+1
Change-Id: I5195d13b351c0eebad1eae901f7ce8408a9e5c92 Reviewed-on: https://gerrit.libreoffice.org/57028 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2018-07-09test: create unit tests for ConfigChris Sherlock4-0/+246
Change-Id: Iaf92f93e169cf7367e3b9fc521f237413a268493 Reviewed-on: https://gerrit.libreoffice.org/53893 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-06XmlWriter: support namespaces, writing of base64 attributeTomaž Vajngerl1-2/+37
Change-Id: I3c1d885d239178b46578123fd83d3aa1d7ccd023 Reviewed-on: https://gerrit.libreoffice.org/56971 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-06-29Improved loplugin:redundantcast (const-qualified typedefs): toolsStephan Bergmann1-1/+1
Change-Id: I919e49f8581d38a82622ca4b8cf9c08de8da4964 Reviewed-on: https://gerrit.libreoffice.org/56705 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-22teach useuniqueptr loplugin about calling delete on a paramNoel Grandin1-15/+7
which is often a useful indicator that the callers can be made to use std::unique_ptr Change-Id: Idb1745d1f58dbcf389c9f60f1a5728d7d092ade5 Reviewed-on: https://gerrit.libreoffice.org/56238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-05tdf#42949 remove unused compheler includes ..Jochen Nitschke2-2/+2
and fix the fallout Change-Id: I15bc5d626f4d157cbc69a87392078b41e621d14e Reviewed-on: https://gerrit.libreoffice.org/54882 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-02valgrind: uninitialized readCaolán McNamara1-1/+1
Change-Id: I29811f652c2368a0fecef66dd02343d12ee67068 Reviewed-on: https://gerrit.libreoffice.org/55178 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-01loplugin: look for CPPUNIT_ASSERT_EQUALS with params swappedNoel Grandin1-7/+7
idea originally from either tml or moggi, can't remember which Change-Id: Id78d75035036d3aa1666e33469c6eeb38f9e624d Reviewed-on: https://gerrit.libreoffice.org/55126 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-26demangle context type name in DBG_UNHANDLED_EXCEPTIONNoel Grandin1-0/+9
Change-Id: I59591d0209ddf2bcf6e57a78dc7999d773b73ae3 Reviewed-on: https://gerrit.libreoffice.org/54805 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-19Revert "tools: test Pair"Noel Grandin4-156/+0
This reverts commit 99dbaba70afb91ed3961f9ff627c35bf54d66bef. Let's land this again once Stephan's comments in https://gerrit.libreoffice.org/#/c/54189/ have been addressed Change-Id: I4230e4ce59a46379548bb510e433c68b021e896c Reviewed-on: https://gerrit.libreoffice.org/54414 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-17loplugin:unusedfields in tools..xmlhelpNoel Grandin1-3/+1
Change-Id: I5e909a8def86ce9ad150440e6c6ad304e855cc69 Reviewed-on: https://gerrit.libreoffice.org/54415 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-17loplugin:redundantcast improvements for floating-integer conversionsStephan Bergmann1-1/+1
Change-Id: I63dbf18f144a792ae775fe6706da81657f790016 Reviewed-on: https://gerrit.libreoffice.org/54416 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2018-05-16tools: test PairChris Sherlock4-0/+156
Change-Id: I03e48c134ec9b8fc53c247ced231f209e1205cb1 Reviewed-on: https://gerrit.libreoffice.org/54189 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-12tools: test for FRoundChris Sherlock2-0/+64
Change-Id: Ifcf0472892fbd37622a1a0505cbf5140cac281f4 Reviewed-on: https://gerrit.libreoffice.org/53718 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-09there are 3600000 seconds in an hourCaolán McNamara3-1/+43
regression from... commit 9830fd36dbdb72c79703b0c61efc027fba793c5a Date: Sun Mar 17 08:36:26 2013 +0100 date/time IDL datatypes incompatible change Change-Id: I2f4b64a73b5529ba190acc678d907761bb568bbf Reviewed-on: https://gerrit.libreoffice.org/54009 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-05-08tools: document and test sanitiseMm100ToTwip()Chris Sherlock2-0/+56
Change-Id: I2f6349c679a714e5168ae3c5eccd054c5522bbc9 Reviewed-on: https://gerrit.libreoffice.org/53814 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-07tools: date unit testsChris Sherlock2-18/+447
Change-Id: I2b3eaf74173f7f456f04c734dfb7c05c95802809 Reviewed-on: https://gerrit.libreoffice.org/53895 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-05Fix typosAndrea Gelmini1-1/+1
Change-Id: I70e17e06279ca8d11a482011c8c74c14ec692ba1 Reviewed-on: https://gerrit.libreoffice.org/53888 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-05-04tools: Avoid looking up system clock twice to get DateTimeTakeshi Abe6-99/+174
DateTime::DateTime(DateTimeInitSystem) had initialized Date and Time separately, which causes a slight possibility that it could get a wrong datetime with almost 24 hours delay when it went beyond midnight. E.g., the date part was of the previous day while the time part was 00:00:00.xxx of the next day. This also reduces duplicate code by sharing GetSystemDateTime(). Change-Id: I352d90f468f5cbc70e7936a337bed97365baa06c Reviewed-on: https://gerrit.libreoffice.org/53612 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2018-04-30tools: test for MinMaxChris Sherlock2-0/+100
Change-Id: Ifbef563c02027e69226ff6585b721c23566435ea Reviewed-on: https://gerrit.libreoffice.org/53451 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-23loplugin:singlevalfields improve unaryoperatorNoel Grandin1-43/+6
when we see a unaryoperator, unless it's one of a small set, we can know (mostly) that the field will not be written. there is still a small risk of false+ with code taking references via conditional expressions. Change-Id: I96fa808067576a50e5eaf425338e225b4e0bdd4e Reviewed-on: https://gerrit.libreoffice.org/53263 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-20loplugin:constantparamNoel Grandin1-63/+58
Change-Id: Ia58d8950b3b9e48bbe9f075b9fe1eed62d9abf0d Reviewed-on: https://gerrit.libreoffice.org/53188 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-18tdf#117044 Base crash when attempting to edit a table definitionNoel Grandin1-1/+1
this story started in commit 433fc2214c980abd82fa6240f45e634a53a3c61c (patch) sal_uIntPtr->sal_Int32 in MultiSelection which caused a regression, reported in tdf#116981. I attempted to fix it in commit 235d61890512894e27f4f81e38a325eee3c67b30 Date: Fri Apr 13 17:14:59 2018 +0200 tdf#116981 Base when deleting table column and commit 0973e1f4e727a3204c843398bcb0e6a411b1a02d Date: Mon Apr 16 08:28:16 2018 +0200 follow on for tdf#116981 But my analysis was wrong. To recap, and get it right: Before all this, MultiSelection stored it's values internally as sal_uIntPtr, but returned them as long in FirstSelected(), NextSelected(),and SFX_ENDOFSELECTION was defined to be ULONG_MAX. On 64-bit Linux, sal_uIntPtr is typedefed to sal_uInt64, and ULONG_MAX is 2^64, which means that previously, the SFX_ENDOFSELECTION value was being converted from 2^64 to -1 when it was returned, which was why these loops worked. So convert SFX_ENDOFSELECTION to -1 to match how how the external code wants it to be (and the code frequently uses -1 instead of SFX_ENDOFSELECTION or BROWSER_ENDOFSELECTION) The modification to MultiSelection::Select is necessary because previously, nCurMin and nCurMax would be == ULONG_MAX, and we would, somewhat unintuitively, end up in the // expand on left side? if( nTmpMax < nCurMin ) part of the logic, which would do the right thing, even if a little weirdly. Change-Id: I7c830b0392add394d8c294247f75a2ffe8017c24 Reviewed-on: https://gerrit.libreoffice.org/53022 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-18tdf#116420: Windows: Test if a filepath redirects to a WebDAV resourceMike Kaganski2-0/+79
In Windows, filesystem redirectors can map WebDAV resources to UNC paths, or to drive-based "local" paths; so a WebDAV URI of the form "http://WebDADServer/root/directory/File.ext" may be accessed using "\\WebDADServer\root\directory\File.ext" or "Z:\directory\File.ext". When using these paths, failure to create a lockfile aside the opened document should not be considered an error; so this patch checks for this. Regression from commit 6ca3b3648e25ae9d4d2d29a0df83349198ec3f5e. Change-Id: I1de55b66447dc91d22b6d2b5b121de96bf32e4ee Reviewed-on: https://gerrit.libreoffice.org/53070 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-16assert that we own the data before freeing itNoel Grandin1-1/+6
Change-Id: I9676da22c00570cd59f2f46b04beb5f1337bbacf Reviewed-on: https://gerrit.libreoffice.org/52887 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-07Revert "long->sal_Int32 in tools/gen.hxx"Stephan Bergmann3-25/+25
This reverts commit 8bc951daf79decbd8a599a409c6d33c5456710e0. As discussed at <https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html> "long->sal_Int32 in tools/gen.hxx", that commit caused lots of problems with signed integer overflow, and the original plan was to redo it to consistently use sal_Int64 instead of sal_Int32. <https://gerrit.libreoffice.org/#/c/52471/> "sal_Int32->sal_Int64 in tools/gen.hxx" tried that. However, it failed miserably on Windows, causing odd failures like not writing out Pictures/*.svm streams out into .odp during CppunitTest_sd_export_ooxml2. So the next best approach is to just revert the original commit, at least for now. Includes revert of follow-up 8c50aff2175e85c54957d98ce32af40a3a87e168 "Fix Library_vclplug_qt5". Change-Id: Ia8bf34272d1ed38aac00e5d07a9d13fb03f439ae Reviewed-on: https://gerrit.libreoffice.org/52532 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-03long->sal_Int32 in tools/gen.hxxNoel Grandin3-25/+25
which triggered a lot of changes in sw/ Change-Id: Ia2aa22ea3f76463a85ea077a411246fcfed00bf6 Reviewed-on: https://gerrit.libreoffice.org/48806 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-02give DBG_UNHANDLED_EXCEPTION_WHEN an area parameterNoel Grandin1-2/+5
and rename it to DBG_UNHANDLED_EXCEPTION, to make it more like the SAL_WARN-type macros. Use some macro magic to deal with different numbers of arguments. Update the sallogareas plugin to check the area parameter of DBG_UNHANDLED_EXCEPTION. Change-Id: Ie790223244c3484f41acb3679c043fb9b438e7c4 Reviewed-on: https://gerrit.libreoffice.org/52073 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-14loplugin:constantparamNoel Grandin1-3/+3
Change-Id: I3ce653c0d9e517229dbbe32cc8d3ec3c206e364d Reviewed-on: https://gerrit.libreoffice.org/51273 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-13ofz#6843 Integer-overflowCaolán McNamara1-0/+12
Change-Id: I3984253ac3e5eaf0be7b10c8ba95d50e6bd9ce5d Reviewed-on: https://gerrit.libreoffice.org/51175 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>