And not truncate it to an integer value.
Add additional overload for attribute that takes an enumerated type, otherwise
the compiler will complain about ambiguous conversion because it cannot
choose between the attribute that takes a integral value and the one that
takes a double value.
Change-Id: I9eae22817ec3b26da7b9468d1c8b5e6f3e900538
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201193
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
Starts a process of converting the call-sites of SvFileStream
to just write data, relying on the stream being set
into the correct encoding somewhere during initialisation.
In this commit, I change WriteByteStringLine to do that.
For most of the call sites, they either:
(a) use the stream encoding explicitly
(b) already set the stream to the encoding being used at the call-site
Only in buildFontMenuName did I need to make the stream explicitly
set the stream encoding.
Also add a utility constructor to SvFileStream to make it easy
to set the stream in the correct mode at open-time.
Ideally a stream should be set into the correct encoding
at open time and never changed.
Change-Id: I57afa74807e15320a176a05d43c94c377dad4561
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200289
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Use the correct term. E.g., Unicode charset has different encodings
like UTF-8 and UTF-16, and we mean encoding here.
Change-Id: I65e90b31cda6e39fdb1584b492e6e0b9821865a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200285
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
...which helps avoid some supposedly spurious -Werror=free-nonheap-object seen
at least with recent GCC 16 trunk,
> In destructor ‘virtual SvLockBytes::~SvLockBytes()’,
> inlined from ‘void SvRefBase::ReleaseRef()’ at include/tools/ref.hxx:160:36,
> inlined from ‘tools::SvRef<T>::~SvRef() [with T = writerfilter::rtftok::RTFTokenizer]’ at include/tools/ref.hxx:56:46,
> inlined from ‘writerfilter::rtftok::RTFLookahead::~RTFLookahead()’ at sw/source/writerfilter/rtftok/rtflookahead.cxx:37:1:
> include/tools/stream.hxx:115:48: error: ‘void operator delete(void*, std::size_t)’ called on pointer ‘((tools::SvRef<writerfilter::rtftok::RTFTokenizer>*)this)[1].tools::SvRef<writerfilter::rtftok::RTFTokenizer>::pObj’ with nonzero offset 56 [-Werror=free-nonheap-object]
> 115 | virtual ~SvLockBytes() override { close(); }
> | ^
etc.
Change-Id: I26a599f0e3258e6bf6a4d6e63e559b41029862db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197842
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
In tests we many times rerun the XPath search to just check another
XML attribute, or first check the size of child elements and then
check each element's attributes in a separate call (re-running the
XPath search). Re-running an XPath search all the time takes up
quite some CPU resources and doing it a lot will accumulate, so the
idea here is to have an object as a result on which you can reuse
instead of re-running the search.
In addition it is possible to combine the search path from the
previous search, so it is possible to construct paths in a more
concise way.
Example:
auto primitivePath = aXPath.create("/primitive2D");
auto polyPath = aXPath.create(primitivePath, "/polypolygon");
polyPath will use a combined path "/primitive2D/polypolygon"
as the search path.
Checking can be done by simply using CPPUNIT_ASSERT* functions
with this, but we might extend UnoApiXmlTest with some checks
for convenience because the assertXPath methods do have better
reporting when the assert fails. Also integration into the
UnoApiXmlTest class will need to be done, because namespaces need
to be registered before tools::XPath can be used correctly. This
change does not touch that yet.
A couple of tests in SvdrawTest have been changed to use the new
tools::XPath class - most notable testRectangleObject. These tests
don't use any namespaces so it is easy to convert those.
Change-Id: I29251d2e7f4c3ee5b76e46daf78c21d0ca067cb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195618
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
We don't use it yet from any C source file, but the plan is to do
that. Mainly from freetype, fontconfig, and cairo, when these are
built for Windows when the --enable-headless options is used (for the
new Collabora Office).
Also some cleanups, sorting #include lines, avoiding warnings, etc.
Change-Id: Ifef3588d06fdcceaeaeb3482399737faaf558d7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195602
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Of course, LibreOffice has tons of APIs from before whose whole point
is to hide system dependencies behind a cross-platform API. All the
"sal" and "osl" stuff, for starters. The wrappers in this file is not
intended to replace those. The point with these wrappers is to quickly
port code that was written for Unix *only* to Windows, with minimal
changes to the source code. Basically you just need to prefix calls to
functions like open() and stat() with wrap_.
In Windows, "file descriptors" are a thing in the C library, not the
operating system. But the C library does provide the same core set of
functionality as Unix-like systems do. The functions use almost the
same names, except that for some reason, to avoid compilation
warnings, you need to call variants with names preceded by an
underscore, like _close().
Another Windows complication is that the file system is based on
UTF-16 names. You can't just pass file names as eight-bit characters
to _open() and expect it to work for all file names. Instead, you need
to call a function with a "w" prefix, like _wopen(), that takes a wide
character string (UTF-16).
This header is in C, not C++, because we want it to be usable from
some external libraries written in C that we compile as part of
LibreOffice in some circumstances, particularly for Windows.
All functions behave like the wrapped ones, set errno on errors.
Change-Id: Ia093ccf976659ceabbef6e0071da73d4df0b63b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195422
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
So we can use it in dumpAsXml functions and eventually use it as
a replacement to directly using libxml.
Change-Id: I204d487b52343f69224fec2fd480657785bc0a69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195167
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
LOK_HOST_ALLOWLIST allows to pass a restricted list of hosts that
curlsession will be allowed to download from.
LOK_HOST_ALLOWLIST_EXEMPT_VERIFY_HOST reuses this list for the use case
of not verifying SSL host additionaly for them. This is useful for say
developpement environement.
Change-Id: I75ac26a4bfe1c33ff183c4ad12391b2da08593cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193961
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 8688e9d8c94a21a7a0abc9edfe632e6fa0e94281)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194187
Tested-by: Jenkins
Reviewed-by: Méven Car <meven.car@collabora.com>
No need to re-invent std::abs. Also drop some static_casts, to
allow warnings in case there will be unexpected values.
Change-Id: Iad1bc7fd22a1c517e4cdce28d156aa42fc5e6ec6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193507
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
...and use it in one place for the experimental Emscripten Qt6
JSPI/non-PROXY_TO_PTHREAD mode (where I have a hunch that some of the deadlocks
I experience in that experimental mode are due to a mis-locked SolarMutex)
Change-Id: Ifb335202569b7d2beecd7a502064ebcfdaaddbab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181872
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
The function was introduced specifically to speed up the common case
of null date value, and we can make use of that.
Change-Id: I26ccd2a4abce7a9d9dcd828a62c700c7319b30ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181700
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
...so that they don't report "unknown" (and make empty links report "empty"
instead, for clarification). This introduces a new LINK_NONMEMBER macro; the
non-default Link ctor should no longer be used directly, so make it private.
Change-Id: I4ae99758de57adb8569ce98cb3824e875b26c959
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180593
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
We use the same funciton all over the place, so create a common
function in o3tl and use that in all instances where we duplicated
the code.
Change-Id: I74091fbbde8c2ba8c7e4ab30194ab53e2a338e52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180372
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>