Commit Graph

29516 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
69d8435a7f Avoid copying vector needlessly
The getLabel method will not consider more than 10 citation keys.
Instead of removing elements from the keys vector, this commit adapts
the for loop to skip unwanted elements.

This allows to pass the keys vector by const reference.

Spotted by Coverity scan.
2024-10-03 10:18:24 +02:00
Jean-Marc Lasgouttes
bc624cc780 Do not pass a vector by value to getArgInset
Instead of passing the vector by value so that stuff can be added to
it in the function, add required elements of arguments to a second vector.

While we are at it, simplify the code a bit by using a range-for and
auto keyword.

Spotted by Coverity scan
2024-10-01 13:06:37 +02:00
Jean-Marc Lasgouttes
54b6846941 Pass parameters as const reference
Spotted by Coverity scan.
2024-10-01 11:12:14 +02:00
Pavel Sanda
b39cc9ed89 Not needed anymore. 2024-09-30 20:11:23 +02:00
Pavel Sanda
601abfe929 PDF options: reflect in UI mutually exclusive colorlinks and frames.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg222961.html
2024-09-30 20:09:35 +02:00
Jean-Marc Lasgouttes
1d64dbf543 Modify string list in place instead of copying it
Spotted by Coverity scan.
2024-09-30 11:20:48 +02:00
Koji Yokota
a086804eb4 Fix IM window position for a new window (#13094) 2024-09-30 09:00:56 +09:00
Thibaut Cuvelier
75f467fa13 MathML: use Core for XHTML, 3 for DocBook.
In a near future, this should rather be controlled by a user-visible parameter.
2024-09-28 16:50:29 +02:00
Thibaut Cuvelier
790c153737 Use proper minus sign character in MathML Core.
Fixes bug https://www.lyx.org/trac/ticket/13067.

Based on the patch in the ticket above by Jean-Marc Lasgouttes.
2024-09-28 16:50:29 +02:00
Thibaut Cuvelier
ca5d5a0b1a amend 2024-09-28 16:50:29 +02:00
Thibaut Cuvelier
a06528ee2a Fix switch indentation. 2024-09-28 16:50:29 +02:00
Thibaut Cuvelier
cb88a362ea MathML: add a version enum. 2024-09-28 16:50:29 +02:00
Jean-Marc Lasgouttes
9fc19badab Streamline use of map<col-type, bool>
Typically, to check whether an element is present and set to true, instead of
  foo.find(c) != foo.end() && foo.find(c)->second
one uses
  foo[c]

The map<> code creates elements automatically when they do not exist
and zero-initializes them.

This avoids puzzlement of Coverity scan when seeing that find() result
is dereferenced without checking that it is not equal to end().
Moreover, this makes the code much much clearer. I still do not
understand it, though ;)
2024-09-26 15:31:28 +02:00
Juergen Spitzmueller
112c2c3d0e Factor out (signed) glueLenghValidator 2024-09-25 10:22:36 +02:00
Juergen Spitzmueller
2244ac3dee Allow negative offset in GuiLine (#13102) 2024-09-25 09:53:00 +02:00
Juergen Spitzmueller
126cbec5e7 Re-focus workarea after some outline context-menu actions (see #1624)
Thanks Pavel for the main idea
2024-09-24 08:47:55 +02:00
Jean-Marc Lasgouttes
194b53ef9d QFontMetrics::xHeight() is not always the ascent of 'x'
Use the real ascent of glyph 'x' as LyX 2.3.x did.
It can make a difference at least on Windows with many fonts.

Fixes bug #13100.
2024-09-23 21:11:49 +02:00
Juergen Spitzmueller
d43e82a5a7 Only \protect labels in \thanks notes
See https://marc.info/?l=lyx-users&m=136394387505489
2024-09-21 11:30:08 +02:00
Juergen Spitzmueller
124f441a00 GuiBibTeX: introduce way to toggle between absolute and relative local paths (#13097) 2024-09-21 07:30:55 +02:00
Pavel Sanda
b7e4cc9a37 Header not needed anymore 2024-09-20 21:33:41 +02:00
Jean-Marc Lasgouttes
77e4092b99 Move assertion at the right position
It would wrongly trigger when doing a multi-cell selection.
2024-09-19 23:18:47 +02:00
Juergen Spitzmueller
f5306b7054 Fix outliner tree depth (#13098) 2024-09-19 10:00:39 +02:00
Pavel Sanda
9d9f13ff83 Move header where needed. 2024-09-18 21:25:18 +02:00
Pavel Sanda
c87b2d5fc2 Header not needed anymore 2024-09-17 19:51:35 +02:00
Jean-Marc Lasgouttes
928f9514a8 More places where DocumentClassPtr should not be copied
Spotted by COverity scan.
2024-09-14 20:40:53 +02:00
Jean-Marc Lasgouttes
8c76a9fc3d Pass sigPtr object as const reference too
Spotted by Coverity scan.
2024-09-14 20:36:04 +02:00
Jean-Marc Lasgouttes
980f91d12e Pass SocketCallback object as const reference
Spotted by Coverity scan.
2024-09-14 20:19:34 +02:00
Juergen Spitzmueller
30f170ea26 Revert "use std::move() instead of copying when value is no longer used"
This reverts commit e685d31f5a.
2024-09-14 10:59:13 +02:00
Juergen Spitzmueller
3a1c8897b1 Revert "Fix compiler warning"
This reverts commit 0a75854038.
2024-09-14 10:59:08 +02:00
Jean-Marc Lasgouttes
375aba7b5d Transform CoordCache::check/checkDim in ASSERT_DIM/POS macros
This makes it more obvious to the reader that these are actually
assertions, and should help Coverity scan too.
2024-09-13 15:44:33 +02:00
Jean-Marc Lasgouttes
3af0bad22a Pass shared_ptr<> arguments by const reference
These arguments are not expensive to copy. However, it makes sense to
pass such pointers by const reference when they are just intended for
reading.

Some reading about this issue is here:
https://www.internalpointers.com/post/move-smart-pointers-and-out-functions-modern-c

Fixes some Coverity scan defects.
2024-09-13 14:54:43 +02:00
Jean-Marc Lasgouttes
58ee4c9ec7 Pass DocumentClassConstPtr arguments by const reference
This arguments are shared_ptr objects, so they are not expensive to
copy. However, it makes sense to pass such pointers by const reference
when they are just intended for reading.

Some reading about this issue is here:
https://www.internalpointers.com/post/move-smart-pointers-and-out-functions-modern-c

Fixes some Coverity scan defects.
2024-09-13 14:16:21 +02:00
Jean-Marc Lasgouttes
3649cea9e5 Make two parameters const references 2024-09-13 11:27:00 +02:00
Jean-Marc Lasgouttes
ffca6730d6 Fix uninitialized variable
Spotted by Coverity scan.
2024-09-13 11:21:19 +02:00
Jean-Marc Lasgouttes
9f40eaee15 Do not use rand() to set a BranchList id
Use a simple counting instead, beecause Coverity complains that rand()
is not safe, and counting is siimpler anyway.
2024-09-13 11:09:30 +02:00
Jean-Marc Lasgouttes
9b3c28178c Make string parameter a const reference
Spotted by Coverity scan.
2024-09-13 10:27:24 +02:00
Jean-Marc Lasgouttes
8e181e992d Avoid a couple of copies.
Spotted by Coverity scan.
2024-09-12 18:33:45 +02:00
Jean-Marc Lasgouttes
7a99ef7fbb Make docstring parameters const references
Spotted by Coverity scan.
2024-09-12 18:28:26 +02:00
Jean-Marc Lasgouttes
b743870d71 Graph::getReachable(): pass a parameter by const reference
Spotted by coverity.
2024-09-12 18:20:43 +02:00
Jean-Marc Lasgouttes
b1bbf64a28 Avoid a copy
Spotted by Coverity scan.
2024-09-12 18:05:50 +02:00
Jean-Marc Lasgouttes
cc40330e00 Avoid a couple of copies
Spotted by Coverity scan.
2024-09-12 17:59:41 +02:00
Jean-Marc Lasgouttes
91f3f27545 GuiWorkArea: pass KeySymbol parameters as const references
Spotted by Coverity scan.
2024-09-12 17:52:57 +02:00
Jean-Marc Lasgouttes
8ea9c2da03 Avoid a couple copies in Trans::addDeadKeys().
Spotted by Coverity scan.
2024-09-12 17:24:32 +02:00
Jean-Marc Lasgouttes
7946dfacfa TransState::addkey() pass parameter by const reference
Spotted by Coverity scan.
2024-09-12 16:54:02 +02:00
Jean-Marc Lasgouttes
eeb84bce17 Pass three string parameters by address
Spoted by Coverity scan.
2024-09-11 17:33:52 +02:00
Jean-Marc Lasgouttes
13b05102f2 Pass a docstring parameter by address
Spotted by Coverity scan.
2024-09-11 17:30:33 +02:00
Jean-Marc Lasgouttes
e6930ffec8 Pass a pair of docstring arguments by address
Spotted by Coverity scan.
2024-09-11 17:25:03 +02:00
Jean-Marc Lasgouttes
851e59cd26 Avoid an unnecessary string copy
Spotted by Coverity scan.
2024-09-11 17:08:45 +02:00
Jean-Marc Lasgouttes
a47d66df34 Pass arguments by address in convert() templates
The situation of the convert<>() template was a mess: the header
announced that template specializations passed strings by address (my
doing long ago), but the code would just define versions that upass
strings by value.

The solution is to pass all values by address. This works very well,
_except_ when the value is a string litteral.

Defining the templates thus requires a bit of work.

Spotted by Coverity scan.
2024-09-11 16:43:26 +02:00
Jean-Marc Lasgouttes
291d2db18e Fix linking of test programs in support/. 2024-09-11 16:42:41 +02:00