Commit graph

31669 commits

Author SHA1 Message Date
Tim Schumacher
dfc682dc40 LibC: Remove deprecation warnings from "unsafe" string functions
We have close to zero usages of the C string functions in our codebase
(including the "safe" alternatives), so the deprecation warnings are
unlikely to have an actual effect on preventing large-scale use of the
"unsafe" functions.

Meanwhile, the deprecation warnings are causing issues for ports that
are compiled using -Werror by default, and are generally a large source
for logspam when compiling.
2021-12-21 19:42:49 -08:00
Hendiadyoin1
27a967371b LibRegex: Remove duplicate declaration of execution_result_name(...) 2021-12-21 18:17:28 -08:00
Hendiadyoin1
303af07df8 LibRegex: Use AK::any_of in Parser::lookahead_any
Equivalent to std::ranges::any_of, which clang-tidy suggests.
2021-12-21 18:17:28 -08:00
Hendiadyoin1
0f4a79a24d LibRegex: Capture this explicitly in RegexStringView::equals lambda
This stops clang-tidy from suggesting that this function can be made
static, although accessing `this->operator==` in the lambda function.
2021-12-21 18:17:28 -08:00
Hendiadyoin1
5885e70df7 LibRegex: Remove some meaningless/useless const-qualifiers
Also replace String creation from `""` with `String::empty()`
2021-12-21 18:17:28 -08:00
Hendiadyoin1
ca69ded9a5 LibRegex: Collapse some if(...) return true; else return false; blocks 2021-12-21 18:17:28 -08:00
Hendiadyoin1
a2563496f5 LibRegex: Remove some else-after-returns 2021-12-21 18:17:28 -08:00
Hendiadyoin1
b674de6957 LibRegex: Add some implied auto qualifiers 2021-12-21 18:17:28 -08:00
Brian Gianforcaro
1fdd1915c2 LibC: Add POSIX spec comments for stat APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
890fba95f7 LibC: Add POSIX spec comments for posix_spawn APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
6fe71970f5 LibC: Add POSIX spec comments for signal APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
ea355fbf17 LibC: Add POSIX spec comments for search APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
140a544051 LibC: Add POSIX spec comments for stdio APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
7fd1de01a7 LibC: Add POSIX spec comments for stdlib APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
11a12c2312 LibC: Add POSIX spec comments for string APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
0f53e0aaea LibC: Add POSIX spec comments for sched APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
6db9b6cf79 LibC: Add POSIX spec comments for qsort 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
e9c46a23c8 LibC: Add POSIX spec comments for select APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
5568aee35f LibC: Add POSIX spec comments for memory management APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
4484634d8a LibC: Add POSIX spec comments for socket APIs 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
3c897d0443 LibC: Add POSIX spec comments for poll 2021-12-21 18:16:48 -08:00
Brian Gianforcaro
954fa724b3 LibPthread: Add POSIX spec comments to our implementations 2021-12-21 18:16:48 -08:00
Linus Groh
e4bba2fab9 LibGfx: Keep alpha value of previous pixel for QOI_OP_RGB chunk
I accidentally skipped this part of the spec in the QOI decoder:

> The alpha value remains unchanged from the previous pixel.

This led to incorrect rendering of some images with transparency,
visible in form of a horizontal line of non-transparent pixels (that
shouldn't exist), e.g. for the following chunk sequence:

- QOI_OP_RGBA with alpha = 0
- QOI_OP_RGB
- QOI_OP_RUN

The QOI_OP_RGB should 'inherit' the alpha value of the previous
QOI_OP_RGBA chunk, instead of always setting it to 255.
I'm unsure why the encoder added the QOI_OP_RGB chunk to the specific
image where the bug was noticed in the first place - they effectively
both had fully transparent color values.
2021-12-22 01:12:51 +01:00
r00ster91
b6d921f682 PixelPaint: Refactor falloff computation and extend hardness range 2021-12-21 13:52:55 -08:00
Luke Wilde
7fae46361b LibWeb: Fix null-deref in <table> delete_row with index = -1 and no rows
This wasn't quite following what the spec says for step 2:
"If index is −1, then remove the last element in the rows collection
from its parent, or do nothing if the rows collection is empty."

It was behaving like:
"If index is −1 and the rows collection is not empty, then remove the
last element in the rows collection from its parent."

Which is not the same, as it will fall into the "Otherwise" if
`index == -1` and the rows collection is empty and try and get the -2nd
element of the rows.

Found with Domato.
2021-12-21 13:51:15 -08:00
Luke Wilde
54454952e0 LibWeb: Capture <script> element's node document on execution
Step 1 of the spec is to capture the <script> element's node document
into a local variable.

When I originally implemented this, I thought this was not necessary.
However, I realised that the script that runs can adopt the current
script element into a different document, meaning step 5.4 and 6 then
operate on the incorrect document.

Covered by this WPT: 7b0ebaccc6/html/semantics/scripting-1/the-script-element/moving-between-documents-during-evaluation.html
2021-12-21 13:50:00 -08:00
creator1creeper1
cacac7927b Calculator: Construct KeypadValue precisely from the Clipboard contents
Previously, we would use lossy strtod() conversion. This was bad,
especially since we switched from internally storing Calculator
state in a double to storing it in the KeypadValue class
some time ago. This commit adds a constructor for the KeypadValue
class that is not lossy by using strtoll(). It handles numbers
with and without decimal points as well as negative numbers
correctly.
2021-12-21 13:22:12 -08:00
Michel Hermier
7ea3d40e19 LibCore: Unconditionally report error in EventLoop::wait_for_event
When `select` fails and `VERIFY_NOT_REACHED()` is reached, it is wise
to always have a trace of what went wrong.
2021-12-21 13:15:17 -08:00
Nick Johnson
08e4a1a4dc AK+Everywhere: Replace __builtin bit functions
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
2021-12-21 22:13:51 +01:00
Xavier Defrang
26bb3e1acf chmod+mkdir: Use convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
Xavier Defrang
9e97823ff8 AK: Add convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
Xavier Defrang
6ca34f5647 mkdir: Implement --mode option
Only supports permissions given in octal format
at the moment.
2021-12-21 13:13:04 -08:00
Xavier Defrang
1255316d26 mkdir: Use LibMain 2021-12-21 13:13:04 -08:00
Astraeus-
9971bb0b05 Profiler: Add horizontal_scrollbar height to initial_height
This prevents the scrollbar from covering the TimelineTrack
when there is one
2021-12-21 22:10:33 +01:00
Ali Mohammad Pur
b8f03bb072 LibRegex: Make append_alternation() significantly faster
...by flattening the underlying bytecode chunks first.
Also avoid calling DisjointChunks::size() inside a loop.
This is a very significant improvement in performance, making the
compilation of a large regex with lots of alternatives take only ~100ms
instead of many minutes (I ran out of patience waiting for it) :^)
2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
66249612d6 LibRegex: Avoid calling DisjointChunks::size() in get_opcode()
That method is O(n), and should generally be avoided.
2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
49cbd4dcca AK: Make DisjointChunks not query size() when there are no chunks 2021-12-21 22:10:07 +01:00
Ali Mohammad Pur
2df54a7b56 AK: Add Disjoint(Chunks Spans)::find(index)
For when the may or may not be out of bounds.
2021-12-21 22:10:07 +01:00
Timothy Flynn
c417374dd6 LibUnicode: Remove linkage from LibUnicode to LibUnicodeData
LibUnicodeData can now be loaded dynamically at runtime.
2021-12-21 13:09:49 -08:00
Timothy Flynn
52394deece LibUnicode: Remove now unused value-from-string generator overload
The generate_value_from_string_for_dynamic_loading() overload was just
temporary until all generates were switched over to dynamic loading.
2021-12-21 13:09:49 -08:00
Timothy Flynn
15e1498419 LibUnicode: Dynamically load the generated UnicodeDateTimeFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
a1f0ca59ae LibUnicode: Dynamically load the generated UnicodeNumberFormat symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
09be26b5d2 LibUnicode: Dynamically load the generated UnicodeLocale symbols 2021-12-21 13:09:49 -08:00
Timothy Flynn
3fd53baa25 LibUnicode: Dynamically load the generated UnicodeData symbols
The generated data for libunicodedata.so is quite large, and loading it
is a price paid by nearly every application by way of depending on
LibRegex. In order to defer this cost until an application actually uses
one of the surrounding APIs, dynamically load the generated symbols.

To be able to load the symbols dynamically, the generated methods must
have demangled names. Typically, this is accomplished with `extern "C"`
blocks. The clang toolchain complains about this here because the types
returned from the generators are strictly C++ types. So to demangle the
names, we use the asm() compiler directive to manually define a symbol
name; the caveat is that we *must* be sure the symbols are unique. As an
extra precaution, we prefix each symbol name with "unicode_". For more
details, see: https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html

This symbol loader used in this implementation provides the additional
benefit of removing many [[maybe_unused]] attributes from the LibUnicode
methods. Internally, if ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF, the
loader is able to stub out the function pointers it returns.

Note that as of this commit, LibUnicode is still directly linked against
LibUnicodeData. This commit is just a first step towards removing that.
2021-12-21 13:09:49 -08:00
Timothy Flynn
749d5ebd68 LibUnicode: Add missing forward declarations to forwarding header 2021-12-21 13:09:49 -08:00
Timothy Flynn
97508b74eb LibUnicode: Remove declaration of function which moved to another header
Unicode::get_number_system_symbol is declared in UnicodeNumberFormat and
defined in UnicodeNumberFormat.cpp.
2021-12-21 13:09:49 -08:00
Timothy Flynn
10a8b6d411 Userland: Add unveil/pledge requisites for dynamic Unicode data loading
Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
2021-12-21 13:09:49 -08:00
alexmajor
35e5cbe3b3 Documentation: Update VSCode configuration
Remove note about CMake Tools as version 1.9.0 has shipped and no longer
needed. Update details for files to latest versions and allow easier
copy and paste into an empty file.
2021-12-21 22:09:06 +01:00
Jelle Raaijmakers
7fa2e792a8 LibGL: Simplify glDrawPixels checks and reduce debug spam 2021-12-21 12:58:58 -08:00
Jelle Raaijmakers
a1fb16e89c LibGL: Implement GL_POLYGON rendering
This is a deprecated feature that is still in use in some older games,
most notably Grim Fandango in ScummVM makes heavy use of it.

Luckily, since you can only draw convex polygons, the end result is
exactly the same as when you would have used `glBegin(GL_TRIANGLE_FAN)`
- so we just reuse that code as-is.
2021-12-21 12:58:58 -08:00