Return std::optional<OString> instead of using a bool
return value and a rtl_String** out param.
This allows switching callers from using the low-level rtl_String
to using OString.
Change-Id: I1d38bbc927e7c5e6a12c18ac61e4b37c68b181f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207544
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
...as emsdk 5.0.3 deprecated the predefined EMSCRIPTEN macro (see
<https://github.com/emscripten-core/emscripten/commit/506052bd8b4e23ded7f2351c62ca3b24d40c8cf3>
"Warn about usage of deprecated EMSCRIPTEN macro. NFC (#26381)"), causing
failures like
> In file included from static/source/unoembindhelpers/PrimaryBindings.cxx:29:
> In file included from include/sfx2/viewsh.hxx:35:
> In file included from include/editeng/outliner.hxx:32:
> In file included from include/tools/color.hxx:26:
> include/osl/endian.h:66:15: error: macro 'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead [-Werror,-Wdeprecated-pragma]
> 66 | #elif defined EMSCRIPTEN
> | ^
> /home/sberg/emsdk/5.0.4/emsdk/emscripten/main/cache/sysroot/include/emscripten/emscripten.h:35:66: note: macro marked 'deprecated' here
> 35 | #pragma clang deprecated(EMSCRIPTEN, "use __EMSCRIPTEN__ instead")
> | ^
To avoid confusion, also suppress the -D$(OS) in
solenv/gbuild/platform/unxgcc.mk that would unnecessarily keep defining
EMSCRIPTEN.
Change-Id: Ic1f187cf1c6417cd95d4092e9cea01a665bd1b2f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/34
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 50291c2ed83bdb49bb827a4a12905d94b8c42035)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This reverts commit 2b4cd99d33.
The 2021 commit framed Windows' write-share enforcement as a
divergence from Unix to be eliminated. The premise inverts the
situation: Unix's lack of mandatory write-share enforcement is a
known weakness, not a property to copy. LO's cooperative .lock-file
mechanism implicitly relied on the kernel guarantee Windows
provided.
The commit predicted "no new scenario will be created" because LO's
Unix path already worked this way. But it missed the silent-overwrite
manifestation reported as tdf#157943: any second writer to the same
path - another process, an external app, or even a separate write
path within the same LO instance - can now silently clobber the
first writer's data, because the kernel no longer rejects their
concurrent write open. Tests don't catch this because they verify
that writes succeed, not that competing writes don't silently lose
each other's data.
The intra-process OLE-edit scenario the 2021 commit addressed is
handled at the right layer (OLE-link activation) in the follow-up,
without weakening the cross-process guarantee.
Change-Id: Ie12d16a8be1516bdd45d1b89155f3ca2615d658c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2003
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204939
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
A lot of places in the code are calling OUString::endsWith with a string
containing a single character. Similar to lastIndexOf, this patch
provides overloads to the two methods to have an optimised version for
the case when there is only one character.
It would be kind of nice if the compiler could handle this optimisation
itself, but it’s unlikely to work because the string version of endsWith
ends up calling rtl_ustr_shortenedCompare_WithLength which isn’t inline
and is defined outside of a header.
The main incentive to do this is to make it easier to change calls to
lastIndexOf that should really be endsWith, as in tdf#171853.
Change-Id: Iaba5a7db3211eb12b0a83f441c0a81e664da6eea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204363
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
Move the approxDiff heuristic from the sc unnamed namespace to rtl::math and
disable floating-point contraction (FMA) for this function.
On ARM64 (Apple Silicon), the use of Fused Multiply-Add (FMA) results in
higher intermediate precision during floating-point operations. While
mathematically more accurate, this prevents legacy rounding heuristics in
approxDiff and approxValue from detecting and cleaning rounding artifacts
in series generation (e.g., 1.1 - 1.0).
Disabling fp-contract forces intermediate rounding to 64-bit IEEE 754
limits. This ensures the noise expected by the approximation logic is
present, restoring consistency with x86-64 behavior and fixing issues where
values like 6.0 are incorrectly rendered as 6.00000000000001.
Change-Id: I54a0f748be6cf817db1f3bdcfd2b355320c3a617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203233
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
Tested-by: Jenkins
The tdf#150118 fix used AccessCheck to check write permissions when
FILE_ATTRIBUTE_READONLY is not set. However, AccessCheck uses a local
impersonation token which does not reflect the network credentials
used by the SMB redirector, causing files on remote drives to be
incorrectly marked as read-only.
Skip the AccessCheck logic for remote drives by detecting UNC paths
(\\server\share\...) and mapped network drives (via GetDriveTypeW
returning DRIVE_REMOTE).
regression after: 1b5d039d8b
Change-Id: I7f1514db89655e8607f64da3d62e8e29c23105f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199997
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
Tested-by: Balazs Varga <balazs.varga@collabora.com>
side-effect of dec1441f716c7631622b9b3e32fdbc666502c006 that removed
unnecessary Carbon.h headers and along with that the premac one that
would have been applied also to sal/osl/unx/uunxapi.cxx
Change-Id: I058e074d3ba7fb42d1ca70e497c6219820597119
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198551
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
1. Avoid explicitly specifying COM_QUERY in calls to QueryInterface
(it is implied from the name).
2. Drop redundant ctor and set() that duplicate QueryInterface.
3. Allow ThrowIfFailed without a message.
Change-Id: I75b545e534efb7e57da131dfd40a2a49d204efac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198033
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Replaced legacy osl::profile with manual parser using osl::file. The
code now reads .ini file line by line to find section and keys. Added
SAL_WARN to alert if a profile file fails to open. Also, section headers
are matched by looking at the content between brackets.
Change-Id: I67ede84cde5911cd35d3944de1cebeef03f82ee0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196192
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Lots of things will have to be tweaked to build core statically for
Windows. This is just one small isolated and fairly obvious trivial
commit. (Assuming that in the disable-dynloading case, for Windows we
want to drop the same dynamic library loading functions in osl as for
Unixish systems.)
Change-Id: Ica0a00d7a3d5b85e5eb933ebd5722824fbf5deeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197503
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
I had added that comment back in 4a415c4c5a
"INTEGRATION: CWS sb83 (1.39.26); FILE MERGED", but on second thought, it might
be better to consider a three-segment botostrap variable reference of the form
${file:section:key} (which are hardly used anywhere, if at all, anyway) to do
something special: It reads the "'osl' profile" <file> and uses the value (if
any) for the given <section> and <key>, without expanding it any further, by
design.
That's in line with what the documentation in OOo's CVS
udk/www/common/man/concept/uno_default_bootstrapping.html said,
> <li>
> Allow indirect expansion of variables through 'osl' profiles:
> <br/>
> KEYVALUE=${sversionrc:versions:StarOffice6.0}
> <br/>
> The first part of the indirection is the file to use for
> expansion, the second part is
> the section and the third part is the key. After expansion the
> variable KEYVALUE has
> the value of the matching key of the sversionrc.
> </li>
and what the original code in OOo's CVS porting/sal/rtl/source/macro.cxx
ArgParserState::expandTerm did,
> // do we have a section?
> OUString value;
> if (section.getLength())
> {
> // expand from profile
> oslProfile hProfile;
[...]
> }
> else
> {
> // expand from ini:
And it's also in line with the documentation in include/rtl/bootstrap.h stating
> An ini-file is only allowed to have one section, which must be named
> `[Bootstrap]` with the square brackets.
> The section may be omitted.
Which implies that the <file> in a ${file:section:key} reference is not actually
a bootstrap ini-file (but rather an "'osl' profile"), because those bootstrap
ini-files should not have multiple sections anyway.
Change-Id: Iaf6e97a61fe5a4a330451794a62067b4add20a05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196674
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
...after 6fce450b8a "Introduce "..."_tstr as a
companion to "..."_ostr/u"..."_ustr in template code" had introduced it for
exactly this piece of code
Change-Id: I767a9f39456d6c58c5ac0478110a0c66434b0e54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196626
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
compareFileName function concealed the important info, so at the place
where assertions were made, no file names were shown. This e.g. gave:
C:/Users/user/lo/LIBO-C~1/sal/qa/osl/file/osl_File.cxx(2038) : error : Assertion
Test name: osl_FileStatus::getFileURL::getFileURL_001
assertion failed
- Expression: compareFileName(aFileURL, aTmpName6)
- test for getFileURL function:
This change intends to make the results more useful, showing names.
Change-Id: Id47636327180e1d2e52f4cfe79a33b63468d0166
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193018
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
It turns out, that despite PrivilegeSet argument is documented as
optional, the function fails without it. So my advise to avoid it
was incorrect after all.
Also, SAL_WARN takes area as the first argument, and a stream as
the second. It makes no sense to "recode" GetLastError result: it
is most informative as is.
Change-Id: Ifd4d4ddc96f5e001c898f7331148b47aeee77f2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192227
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
01:26,47 is 0.001000810185185185, which has 16 significant decimals. It
is converted to string as "0.00100081018518519" (15 significands).
The problem was, that when criterion "=0.00100081018518519" is used to
check value 0.001000810185185185, the two numbers differ in five least
significant bits, but rtl_math_approxEqual uses 0x1p-48 to ignore last
four bits only. This is a common problem for numbers close to 1.0E(N).
This change introduces a second threshold, in addition to "only take
into account 48 signigicant bits of mantissa": it calculates the value
of half of 15th decimal unit of the smaller absolute value, and uses
the greater of the two thresholds for the approximate equality.
Change-Id: I2f98ab23c94ca3a2949c3762fbfb6ea563eef94b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191883
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
fast_float implements C++17 from_chars for floating-point types, which
is still unavailable even in the latest versions of compilers e.g. for
macOS. It is maintained, unlike dtoa; it is said to be adopted as the
from_chars implementation for gcc. It is header-only, which simplifies
many things.
Change-Id: I6b597d4d35a076930e6e35f4f8cff3ca84f48ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191248
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
No need to put the minus to the buffer, process it in conversion,
check a second special case string, and reset bSign, when we can
handle unsigned number, and negate it as needed.
Change-Id: I6b9bfb06ab984017fa0078225a1c7281a7b8a99e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191145
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Use a struct for that, and its 'insert' method, to avoid repeating code,
and make the logic more transparent.
Change-Id: I90fd4879e1b680ededc3aa4692fb6f59eeb5916c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191144
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins