Commit Graph
20 Commits
Author SHA1 Message Date
Noel Grandin 7183b3ba23 loplugin:constmethod handle more cases
remove some of the naming limitations, and handle pointer parameters
better.

I only let the plugin run up till vcl/

Change-Id: Ice916e0157031ab531c47f10778f406b07966251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122892
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30 19:00:57 +02:00
Noel Grandin 8148a46c78 no need to copy the name in XmlWalker::attribute
sName and the parameter we pass to xmlGetProp are both null-terminated
char strings

Change-Id: Ia8cb036f33cada8fa59d1e4f05df318a9cf28115
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30 13:58:19 +02:00
Tomaž Vajngerl 9ef167c384 tools: handle special chars correctly in XmlHandler + test
Add the char encoding handler when calling xmlOutputBufferCreateIO
so that special chars are handled correctly. Previously we just
set nullptr.

Change-Id: I7ef44130869625cc4662bf168550a3f987390287
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117355
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-06-17 15:03:29 +02:00
Caolán McNamara 7a5014b24e silence coverity unchecked return value from library on xmlText* functions
Change-Id: I651abb00d8ae1bdbf758a6a0176fd8912531a585
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112753
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-19 21:07:04 +01:00
Tomaž Vajngerl cd65d6c067 tools: support reading xml namespace with XmlWalker
Adds methods namespaceHref and namespacePrefix for reading the
current element's namespace prefix and the href.

Change-Id: I1c16857c6fc0bdfde2d983d8f42f153111119029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109442
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-17 01:07:29 +01:00
Stephan Bergmann 35e471bb4d Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY.  These had been missed by
1b43cceaea "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).

This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).

The improvement to loplugin:stringadd became necessary to fix

> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
>   File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
>   File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.

Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11 21:25:10 +01:00
Stephan Bergmann 4f0c70fb55 Avoid calling OString ctor with null pointer
...in preparation of potential future changes from using OString to using
std::string_view, where OString has an undocumented feature of allowing
construction from a null pointer.

This is mostly the result of a manual audit of potentially problematic getenv
calls across the code base.  But there can be other problematic places too, like
the xmlGetProp call in tools/source/xml/XmlWalker.cxx.  To identify those,
rtl_{string,uString}_newFromStr aborts now in non-production debug builds when a
null pointer is passed(and all places that hit with a full `make check
screenshot` have been addressed here).  Once we are confident that all
problematic places have been identified, we should drop support for the
undocumented feature (see the TODO in sal/rtl/strtmpl.cxx).

Change-Id: I595cc6d4f1cda74add2a3db171323f817d362b08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107430
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-10 16:27:35 +01:00
Noel Grandin c42cf09f17 Revert "loplugin:constfields in tools"
This reverts commit 833c4965fc.

Change-Id: I130a91538627f9e83d94615e2ddd48da5a075d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90517
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-15 16:28:03 +01:00
Tomaž Vajngerl d016e052dd pdf: extract XMP metadata writing and use XmlWriter
Instead of writing XMP metadata with a string buffer, change to
use XmlWriter instead. Extract XMP metadata writing into its own
class vcl::pdf::XmpMetadata.

This also needs a change to the XmlWriter to not write a classic
XML header: '<?xml version="1.0" ... ?>'

Change-Id: I95ea0e7ba58e7c43a0c707bf9c676994210ff104
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85908
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-12-28 19:46:50 +01:00
Stephan Bergmann 92a8faa5ea Improved loplugin:stringconstant (now that GCC 7 supports it): tools
Change-Id: I6391e8caf4e344d410a31f45d391059498ebd928
Reviewed-on: https://gerrit.libreoffice.org/76635
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-31 12:53:30 +02:00
Noel Grandin b52f309f2b improve loplugin simplifyconstruct
to find stuff like
   OUString s = OUString("xxx")

Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04
Reviewed-on: https://gerrit.libreoffice.org/70697
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-15 08:37:54 +02:00
Tomaž Vajngerl 24f7dd6251 move and extend primitive2dxmldump to drawinglayer
Also needs extending the XmlWriter to output double numbers as
the attribute content.

Change-Id: Ie749ea990d856c8c90092ed8153c24efda99c444
Reviewed-on: https://gerrit.libreoffice.org/67573
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-02-09 11:58:06 +01:00
Gabor Kelemen 43635b474c o3tl::make_unique -> std::make_unique in tools..xmloff
Since it is now possible to use C++14, it's time to replace
the temporary solution with the standard one

Change-Id: Ib3201f865d43f372007cdf381c7e244e9cbeae26
Reviewed-on: https://gerrit.libreoffice.org/67474
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-08 12:30:06 +01:00
Gabor Kelemen f3b3450868 tdf#42949 Fix IWYU warnings in include/tools/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I9dc920e9388f9e2aa4dcae1f0b3f7562d08f7f70
Reviewed-on: https://gerrit.libreoffice.org/61809
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-17 12:30:05 +02:00
Noel Grandin 833c4965fc loplugin:constfields in tools
Change-Id: I83499cfb49f7abdbf0629c60167d09a1352571ee
Reviewed-on: https://gerrit.libreoffice.org/60987
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-27 08:29:49 +02:00
Noel Grandin 24eae7bd70 clang-tidy performance-unnecessary-value-param
Change-Id: I69247498e13331f6ef84afeb242479f8fb1178a8
Reviewed-on: https://gerrit.libreoffice.org/60068
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-06 09:54:25 +02:00
Tomaž Vajngerl 72aa159a6f XmlWriter: support namespaces, writing of base64 attribute
Change-Id: I3c1d885d239178b46578123fd83d3aa1d7ccd023
Reviewed-on: https://gerrit.libreoffice.org/56971
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-07-06 18:26:36 +02:00
Tomaž Vajngerl e1fb3d95ac Remove XmlWriter in test module and use tools::XmlWriter
Change-Id: I0a0e07a6a71ed95d783d35b7d94b857074ec3450
Reviewed-on: https://gerrit.libreoffice.org/47523
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-01-07 09:34:44 +01:00
Stephan Bergmann b536e10390 Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format
...even if that can cause reformatting of already formatted code.  The problem I
came across is that without this something like

> namespace {
>
> void f1();
>
> void f2();
>
> }

(which is quite a common style in the current code base) would be changed to

> namespace
> {
>
> void f1();
>
> void f2();
> }

instead of

> namespace
> {
> void f1();
>
> void f2();
> }

and I found no other clang-format style option that would result in the
presence or absence of an empty line be identical at the start and end of the
namespace block.

vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the
same time, so this commit includes that.  Some of those new files had not been
formatted at all, so this commit includes their full reformatting changes.

Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c
Reviewed-on: https://gerrit.libreoffice.org/44450
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-08 15:35:18 +01:00
Tomaž Vajngerl 1f8c3e3b78 Extract XmlWriter and XmlWalker from opencl into tools
In opencl we read and writer the profile xml with custom classes
XmlWriter and XmlWalker for reading. This classes are useful in
other places (very similar XmlWriter is used in test), so extract
the code from opencl and move it to a more common place - tools.

Refactoring of other usages will follow.

Change-Id: I8363e87b7c30083d299080adec3f99cb33ebe4cc
Reviewed-on: https://gerrit.libreoffice.org/44149
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2017-11-01 23:42:02 +01:00