Commit graph

968 commits

Author SHA1 Message Date
Ashod Nakashian
2a58fcaa93 wsd: utility to read small files in memory
Change-Id: I9b98f8706c0c32ed59c4f49844570225532a1a59
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Michael Meeks
cce3767ba8 First cut SIMD wrappers / separation to accelerate RLE code.
Split it out as a C file, to avoid accidental C++ header inclusion,
and C is a cross-platform assembler anyway so a good match.

Change-Id: I6c042781713aecaf143b9663af8377659a7deaf1
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Ashod Nakashian
3a91ff3e4e wsd: test: exit on failure to load unit-test lib
We now exit immediately with error code when
we are given --unitlib argument but fail to
load the given library.

Change-Id: I4eb5f3a37b9838ecf83bdceef4d09f888afcca83
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 08:58:39 +02:00
Patrick Luby
e7bd50c967 Fix minor iOS build and runtime problems
This patch contains changes to iOS and/or Android code only.

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ia1461b0b3ca374b682494a7e2e900b832c85ea9d
2023-09-12 00:49:18 +02:00
Miklos Vajna
790a19ab25 kit: improve date format of UNO commands in crashreports
Old format:

	kit-27634-02839 2023-08-30 11:08:43.590564 +0000 [ kitbroker_17a ] SIG   Fatal signal received: SIGSEGV code: 1 for address: 0x4f00000007
	      unoCommand(2552f) : ToolbarMode?Mode:string=notebookbar_online.ui - Wed, 30 Aug 2023 11:08:31

New format:

	kit-30199-30197 2023-09-06 14:30:21.417817 +0200 [ kitbroker_001 ] SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for address: 0x3e8000075f7
	Recent activity:
		unoCommand(064) : ToolbarMode?Mode:string=notebookbar_online.ui - 2023-09-06 12:29:56

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Idf62ea18c75c453d188d8c25723a43824d5fc147
2023-09-11 10:07:19 +02:00
Paris Oplopoios
e67fa117f6 Revert "Fix getting canonical view id of 1000"
This reverts commit 6448c8be0d6a6a58f46c6e1ec2755138b9e7e3d1.

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
2023-09-06 10:28:26 +02:00
Caolán McNamara
24317d555f ensure we don't split a utf-8 sequence when logging message
Given a well-formed utf-8 string 'message' of messageLen bytes and a
desire to truncate to approximately abbrevLen bytes return the shortest
string greater or equal to abbrevLen that does not split a utf-8
sequence.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie623d8c1027bb4724485cab5b0bb6d3d1cd3d9ab
2023-08-25 08:41:46 +02:00
Caolán McNamara
3e7ae50ec1 messages to be logged might not end in a new line
they sometimes do, and sometimes not, we can't assume that the last
byte is a newline and can be discarded without truncating message
text.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie5ea00f927a558b43b2ae38e1cac96c805e93fcc
2023-08-25 08:41:46 +02:00
Caolán McNamara
a3b32c5203 use the same level of building blocks in each getAbbreviatedMessage impl
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia38dc3a8318c0d2adad9bf7f879b7b8a55e5ad77
2023-08-25 08:41:46 +02:00
Caolán McNamara
a4e74dedab std::string variant of getAbbreviatedMessage would include trailing newline
for a short non-abbreviated message if it ended in a newline which the
more common variant would not.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4105fb8eb67b3a38aebc745dfb1e79aa99f2d878
2023-08-25 08:41:46 +02:00
Caolán McNamara
a3f5ca0057 one of the getAbbreviatedMessage variants creates results 1 char longer
the std::string variant uses:

Util::getDelimiterPosition(message.data(), std::min<size_t>(message.size(), maxNonAbbreviatedMsgLen + 1),...

while the more commonly used const char* version has

getFirstLine(message, std::min(length, maxNonAbbreviatedMsgLen)

where getFirstLine is...

return Util::getDelimitedInitialSubstring(message, length,...

and getDelimitedInitialSubstring has

const size_t size = getDelimiterPosition(message, length, delim);
return std::string(message, size);

so the std::string variant's condition is one char longer for the same input

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5b8c4523844501a43731ff3b4a939b76ebe472c3
2023-08-25 08:41:46 +02:00
Caolán McNamara
ca6044cd40 move max 500/501 len into a single place
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I71f44b88b62bd1d2daa7d5019e14e58cc15c7e02
2023-08-25 08:41:46 +02:00
Caolán McNamara
afe6c1bed8 reduce cost of TileDesc::parse
perf reported 6.58% of time in collaborative multi user test
on 2023-08-24 was spent in TileDesc::parse and much of that
in std::unordered_map.

There are only 12 arguments in the map we care about here so
we can just used a sorted array, look by name on write, and
read by index.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iadfc2001e298d8f4d46200c8488f0eb4cd8734c2
2023-08-24 22:22:43 +01:00
Caolán McNamara
da54b23538 cid#322632 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If53b75521fa07d89828aaff06834f741e2b64a5a
2023-08-24 08:30:40 +02:00
Caolán McNamara
492f678996 add and use 'N_ELEMENTS' in lieu of std::size
which isn't available in the current android toolchain

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5834adb7c6211c7aad38f5977a7e425d9ca257fd
2023-08-23 12:06:31 +02:00
Caolán McNamara
6d5c78dec0 move "combined" bit inside TileCombined class
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I274c5844660acbf69e50587cce3f4ddcae414723
2023-08-21 20:48:31 +01:00
Caolán McNamara
851c232531 cid#318843 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Icb757fdc094f428a351df5db6afa53da04be51d1
2023-08-16 15:15:59 +02:00
Caolán McNamara
42df0dac71 cid#318842 silence Unchecked return value
and

cid#318906 Unchecked return value

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9033f43dbbbcae8f5a15980d6f7b844370d54c7f
2023-08-15 15:09:36 +02:00
Caolán McNamara
3502e1d006 cid#318903 Dereference after null check
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I37eeff9afc12a27744a7178da58f4c9b71272c12
2023-08-15 08:21:44 +02:00
Ashod Nakashian
efe874f89c wsd: simplify shutdown and termination flagging
With the use of a single flag for both, the
logic is now less ambiguous, as we cannot have
termination flagged without also implying
shutting down.
The assertions are no longer needed.

Now that setting the termination flag
explicitly implies having the shut down flag
as well, the checks are simpler. We only
need to check that the shutdown is not set
to continue running as normal, since having
the termination flag must perfoce mean shut
down is also set, there is no need to check
both.

Change-Id: I99e22f5668385182b0594040a8e3354b55e74642
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-14 16:32:50 +02:00
Ashod Nakashian
35dda35f9d wsd: move statics into anonymous namespace
Change-Id: I97b0cd7de96eced1a4023e55171b1e35b52a95c7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-14 16:32:50 +02:00
Caolán McNamara
f7e121e2ea cid#318953 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I863ce92808f93e98fecb6022324228b5acdba141
2023-08-14 12:31:55 +02:00
Caolán McNamara
b1f88c4cb2 cid#318875 Dereference after null check
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I40c824e26183f0c0c17e1503dc1c438ba1d2ce5c
2023-08-09 13:39:23 +02:00
Paris Oplopoios
d0c5321aaf Fix getting canonical view id of 1000
Also tilecombine request now uses the canonicalviewid

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ib386edcf78de17cb4fc3d8c3c6ce65f6b52c8b5f
2023-08-05 12:00:08 +03:00
Ashod Nakashian
75ae9894b9 wsd: Util::make_unique -> std::make_unique
Change-Id: I1063913f91571ea6ad95386a3da6a4072574d155
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
5b52f7d8eb wsd: smart pointer cleanup
std::make_shared and std::make_unique
are superior to explict smart pointer
construction. Where we have private
constructors, we can't use them.

Change-Id: I492122f58e958113c6e6d31445c6614ad98c89aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
35605510aa wsd: include string_view
Change-Id: I85632cd6a9fece7d63ca2402c2cf924465df5e43
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Michael Meeks
85152bf953 Typos: wake-up.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I8ae12c8c8390997bbde7af1e203e9075dfa4ea25
2023-07-17 11:35:25 +02:00
Marco Cecchetti
abca8e5dd3 Adding support for enabling/disabling a11y support from the ui
Added toggle button/menu entry for enable/disable accessibility support.
This ui feature is available for Online Writer only.
The button/menu entry is added only when accessibility is enabled at
server level.
That allows to enable/disable accessibility per view.
By default, the accessibility support is disabled.
Anyway the accessibility support state is saved to local storage
if available.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: If5968a47f17922038b9da3d320cbed84ebb7688b
2023-07-10 16:02:18 +02:00
Michael Meeks
3203db2be2 Cleanup includes.
Change-Id: I062579fc7dee2283e6ac62e67c844cf89c3a3188
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-08 13:08:59 +01:00
Ashod Nakashian
1cac1f1698 wsd: test: do not advance to next test on failure
Change-Id: I2831c90e088064f5a254ef8a9809796e8320ed04
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
037099fe32 wsd: cosmetic improvements to ClipboardCache
Change-Id: Ie3ccc015203463fcd9f4a9a26826e0d894f9ec50
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
d50b4e4b1c wsd: test: dump state on test failure
Seems a useful thing to capture the internal
state when a test fails, as it might help
understand what was going on.

Change-Id: I591a88662ab86ab4dc7f39dafcc4d7d279a4d9c4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
8ef57dd2ec wsd: better newChild unit-test event
Change-Id: I8403e14780ad0bf971625934b7011fba1f24f07c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
13b6f64d59 wsd: unmount the test mount directory too
We test if mounting is possible by mounting
a test directory. This can leak in crashes
and failed tests, therefore it needs to be
cleaned up too.

Change-Id: I2638cc0863f3f5575f697bece9801d42cd321ed1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Caolán McNamara
0231a4d2a2 impress slide previews are not 256x256 so triggers assert
but they don't go through the delta mechanism, so move the assert
to the delta path, the other path is ok wrt gt 256x256

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2ba4d8affb7645349540f3a5de31d1802f04c53d
2023-07-06 09:13:45 +01:00
Caolán McNamara
b44a2b71b9 cid#318946 Argument cannot be negative
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I83716319a797ffb5e49c4b98676bfe864a75dec5
2023-07-05 14:49:59 +02:00
Caolán McNamara
bc4a699735 cid#318871 Unintentional integer overflow
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6af42166c495032a6e76532cc2e919a8d01a63c7
2023-07-05 14:49:59 +02:00
Caolán McNamara
d75f3ffb6e cid#318901 Untrusted loop bound
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic3455b21f9c2b7c8928c6d3b64f8790a203e3379
2023-07-05 14:49:59 +02:00
Caolán McNamara
76a5a9baff transport in rgba order
so if core is compiled with a cairo using rgba the pixels can
be sent without need to reorder in server or client

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaf0410f1eaa605b9ce2716625f6c968bca523ccb
2023-07-05 11:58:54 +01:00
Michael Meeks
36818e9153 tiles: track invalidation by monotonic timestamp.
We want to keep pre-loaded, and invalidated tiles around so that
we have something to render in lots of cases, particularly for
other parts, and slides. However - we need to know that it is
invalid so we can on-demand fetch something better.

It is very important that this invalid state doesn't race with
tile arrivals ie. in a banal way:

	invalidate, req, invalidate, req, tile, invalidate, req, tile

it is unclear whether the latest tile is still invalid; similarly,
if we request(req) a tile and there is no change to it we get no
response.

To disambiguate this, use the monotonic wid to check we are in-sync.

Re-factor:
	setup debug tile layer more pro-active.y
	rename HasContent to NeedsFetch to be more explicit.

Remove:
	previous _invalidCount that was perhaps a similar idea.
	previous .loaded concept.
	previous _pruneTiles concept - now it seems we can be
	confident in cached tiles from other slides and sheets.

Change-Id: Ibc6d3b6050e756ace91a9bd53d3e4efe12b023cf
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-03 20:27:07 +01:00
Ashod Nakashian
e0ea9fc883 wsd: some clang-tidy warning fixes
Change-Id: I5d5cce6bec9b377025640d10e7a0053b9f6ddd91
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-30 21:45:40 +02:00
Caolán McNamara
4730458b97 cid#318835 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I964fc80c2bb7bddb8391e631ce179bf947fce55e
2023-06-29 08:03:00 -04:00
Caolán McNamara
d900c3fc12 cid#318841 markup forcedExit as a fatal path
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8825d8f2756c33d10efe9bc40129fbf4871e9de0
2023-06-26 07:08:46 -04:00
Ashod Nakashian
9efc81a51b wsd: random device mounting
We now warn when we fail to use mknod
to create the random devices and have
stricter requirements to mounting
character-devices. Specifically,
we explicitly only allow mounting
the random devices.

Change-Id: Ib0dc300dedc40942ea52426af2b267f6a81fbeb8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-23 18:13:59 +02:00
Caolán McNamara
490b0c0d0d drop non-standard width=400 height=400 tile request in unit test
there since:

commit 232499f542
Date:   Thu Apr 21 12:34:30 2016 +0300

and

commit bf66f7a908
Date:   Mon Jun 13 20:31:14 2016 -0400

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I04745be0581a697bbc3b15ba1d8bb94207320a7a
2023-06-23 16:55:25 +01:00
Michael Meeks
12e0830b1b Kill canceltiles support completely.
This stopped working well a long time ago, and is already disabled
on the coolwsd side, so dung out the rest of the code & docs on this.

Change-Id: I2e0b73fe9780e16c3cc74ae3a38ae6b04434717a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Caolán McNamara
dc044b532f cid#318910 Logically dead code
this should presumably be checking caps_none not caps and is a cnp
error

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I46f381fbec31b3e9c311f1becf0c536c192788fd
2023-06-21 08:40:21 +02:00
Ashod Nakashian
214f212571 wsd: fallback from mknode to bind-mount for random devs
In some cases we may not have permission to create devices.
This happen on nodev systems and some containers. In
those cases, we gracefully fallback to bind-mounting.

Ideally, we would like to reduce the number of bind-mount
cases we do per document, which i why mknod is preferred.

Cleaning up works without modification because the
random devices are mounted in /tmp (in the chroot),
which itself is bind-mounted. So removing it is
sufficient.

Change-Id: If9a4f0a511273952ead95d6c6855ca2becaf757f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00
Ashod Nakashian
95cf60ed5c killpoco: use own file stat helper
Change-Id: I668c2aab04083689a867e7d1f77e2b52c9351969
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 09:42:49 +02:00