Commit graph

45719 commits

Author SHA1 Message Date
Tim Schumacher
d1711f1cef AK: Define our own concept of "trivially serializable"
While at it, rename the `read_trivial_value` and `write_trivial_value`
functions to `read_value` and `write_value` respectively, since we'll
add compatibility for non-trivial types down the line.
2023-01-15 23:06:31 -05:00
Tim Schumacher
6777cb0975 LibCore: Fix up type mistakes in Stream::read_trivial_value 2023-01-15 23:06:31 -05:00
Lucas CHOLLET
3b824ec8c9 AK+Test: Fix a logic error in CircularBuffer::offset_of()
This error was introduced by 9a7accdd and had a significant impact on
`BufferedFile` behavior. Hence, we started seeing crash in test262.

By itself, the issue was a wrong calculation of the internal reading
spans when using the `read` and `until` parameters. Which can lead to
at worse crash in VERIFY and at least weird behaviors as missed needles
or detections out of bounds.

It was also accompanied by an erroneous test.

This patch fixes the bug, the test and also provides more tests.
2023-01-15 23:23:24 +00:00
BodilessSleeper
c5daa6d997 LibJS: Remove redundant ToString from ToTemporalZonedDateTime
Assert that the type of offsetString is either undefined or
string in order to avoid unnecessary ToString
Temporal commit: tc39/proposal-temporal@24ebcbd
2023-01-15 21:35:25 +00:00
BodilessSleeper
219db02b2f LibJS: Assert TemporalDateTimeToString if showCalendar is "never"
The only part of TemporalDateTimeToString that can fail is
MaybeFormatAnnotateCalendar which cannot fail if showCalendar is
"never" as it simply makes an empty string.
Temporal commit: tc39/proposal-temporal@a1faee6
2023-01-15 21:35:25 +00:00
Jelle Raaijmakers
5ed53b3474 LibGfx: Prevent reading OOB in TGA header decode 2023-01-15 19:59:33 +01:00
Tim Ledbetter
68fa8525bf ClipboardHistory: Add a Clear history action
This clears the history from the table view and clears the clipboard.
2023-01-15 19:19:06 +01:00
Tim Ledbetter
944c43a8b4 ClipboardHistory: Ensure model is populated on startup
This ensures that, if the applet restarts, it will remain in sync with
the clipboard.
2023-01-15 19:19:06 +01:00
Tim Ledbetter
174135f909 ClipboardHistory: Update clipboard when the topmost item is deleted 2023-01-15 19:19:06 +01:00
Tim Ledbetter
0f831dbcc7 ClipboardHistory: Don't attempt to delete an item if nothing is selected
This prevents a crash if the delete action is invoked using the delete
key while nothing is selected.
2023-01-15 19:19:06 +01:00
Tim Ledbetter
810c23b422 ClipboardHistory: Invalidate model on item removal
Not doing this caused the window to not update until the mouse was
clicked again.
2023-01-15 19:19:06 +01:00
Arda Cinar
c1ee919add ls: Add an option to print the human readable sizes in powers of 10 2023-01-15 19:12:19 +01:00
Arda Cinar
b1c7575769 du: Add an option to print the human readable sizes in powers of 10 2023-01-15 19:12:19 +01:00
Arda Cinar
ae36a80a6c df: Add an option to print the human readable sizes in powers of 10 2023-01-15 19:12:19 +01:00
Tim Ledbetter
dd582e4ae3 PixelPaint: Hold shift to increase move tool speed with the arrow keys
Holding shift while using the move tool with the arrow keys now moves
the selected layer in 10 pixel increments.
2023-01-15 19:11:25 +01:00
Sam Atkins
431c4165b5 Spider: Confirm ending the current game in more situations
As for Solitaire, we previously had a warning when trying to exit Spider
while a game was in progress. This adds the same functionality to other
actions that would end the current game: Starting a new one, or
changing the number of suits. When changing the number of suits, we do
apply the setting, so it will take effect for the next game that is
started.
2023-01-15 11:59:59 -05:00
Sam Atkins
8b59517ff2 Solitaire: Confirm ending the current game in more situations
We previously had a warning when trying to exit Solitaire while a game
was in progress. This adds the same functionality to other actions that
would end the current game: Starting a new one, or changing the number
of cards drawn. When changing the number of cards drawn, we do apply
the setting, so it will take effect for the next game that is started.
2023-01-15 11:59:59 -05:00
Lucas CHOLLET
c0ada49a24 WidgetGallery: Use the non-deprecated API of LibFileSystemAccessClient
The patch is tiny as WidgetGallery is only using `LibFSAC` for its file
picker.
2023-01-15 16:39:12 +00:00
Liav A
01db302a33 Utilities: Add new utility for converting images to raw bitmap binaries
I used this utility to check if the possible TGA images' cases for
different origins (explictly the Y origin) are generating the same
bitmap, as I felt that my eyes are not a good-enough measurement tool
for this kind of task.
This might be useful in the future for testing other implementations so
I rather have this nice utility in our codebase.
2023-01-15 12:43:03 +01:00
Liav A
b2626d3bc1 Lagom/Fuzzers: Add fuzzer for the TGALoader code 2023-01-15 12:43:03 +01:00
Liav A
71f275b5ad Tests/LibGfx: Add tests for compressed TGA images 2023-01-15 12:43:03 +01:00
Liav A
2f2d808869 LibGfx: Add support for RLE compressed TGA images
RLE is an old technique being used for decades, as is known as
Run-Length-Encoding, which means that for repeating sequence of bytes,
we keep an indicator for the length of the sequence and only one sample
of it, to save storage space.

GIMP can generate lossless-compressed TGA images, with RLE compression
being used. It means that for a compressed image, the data is no longer
arranged in sequence of pixels, but a sequence of pixel packets.
There are two possible pixel packets:
- RLE packets, which are encoded with one byte for indicating the
  run-length and another one pixel (3 bytes for TrueColor pixel), so
  essentially in runtime, the TGA decoder will use the length to plot
  the same pixel in multiple pixels of the output pixel bitmap.
- Raw packets, which are encoded with one byte as indicator for the
  length of the whole pixel sequence and N-length pixel sequence
  afterwards.
  This is not used for any sort of compression by the TGA format, but
  still needed to be supported for full compatibility with TGA images
  that uses the RLE compression.
2023-01-15 12:43:03 +01:00
Liav A
6bf2460231 Tests/LibGfx: Add tests for top-left and bottom-left TGA images 2023-01-15 12:43:03 +01:00
Liav A
a46df41265 LibGfx: Handle tga images with top-left and bottom-left orientation
GIMP allows a user to export a TGA image with either of these possible
orientations, so we can easily support it by looking at the X origin and
Y origin values to determine where to put the pixels in the bitmap.
2023-01-15 12:43:03 +01:00
Tom Needham
761b89c28e Base: Add ImageViewer as the default app to open TGA files :^)
This patch allows .tga files to be opened by ImageViewer automatically
when selected in FileManager
2023-01-15 12:43:03 +01:00
Tom Needham
591bebe662 LibGfx: Add the TGA format into the list of bitmap formats :^) 2023-01-15 12:43:03 +01:00
Tom Needham
5bce58cd3e LibGfx: Plumb the TGALoader into ImageDecoder :^)
This patch plumbs the TGALoader into ImageDecoder
so TGA images can be decoded by the system
2023-01-15 12:43:03 +01:00
Tom Needham
21db070887 LibGfx: Add TGA Loader :^)
This patch adds a basic TGA Loader. Currently it can only handle
uncompressed files with a bit depth of 24 or 32 bits per pixel.
2023-01-15 12:43:03 +01:00
Arda Cinar
70da5f977b hexdump: Add an option to specify dump offset
This is very helpful when trying to make sense of large binary files :^)
2023-01-15 12:10:21 +01:00
Andreas Kling
db27499865 LibWeb: Make sure that fetch() response cookies get saved
We have to provide the Web::Page* in order for cookies to get saved.
2023-01-15 10:53:58 +00:00
Lucas CHOLLET
667ac961b5 Presenter: Use the non-deprecated API of LibFileSystemAccessClient
The patch is tiny as Presenter is only using `LibFSAC` for its file
picker. Using only `LibFSAC` in Presenter would be nice.
2023-01-15 11:37:21 +01:00
nipos
bfacbe1e0d LibCore: Enable file descriptor passing on OpenBSD 2023-01-15 01:11:46 +00:00
Agustin Gianni
4a816ed891 LibC: Fix incorrect limit for SSIZE_MAX and remove 32 bit definitions
The file `limits.h` had definitions for x86. This PR removes these
definitions and fixes the upper limit for the type ssize_t which was
defined to be 0x7fffffff.
2023-01-15 01:07:05 +00:00
Timothy Flynn
bb4c7b6a35 LibJS: Remove now-unused ThrowableFormat header
The one place this was used now uses the fallible String::formatted.
2023-01-15 01:00:20 +00:00
Timothy Flynn
9f78e8728a LibJS: Port (most of) String.prototype to String
The locations that haven't been ported have a much wider footprint than
just the String.prototype files, so they've been left alone for now.
2023-01-15 01:00:20 +00:00
Timothy Flynn
ceaec41726 LibJS: Port Value to-string methods to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
46dd8c1c0b LibJS: Resolve all UTF-8 rope strings as a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
58bc831750 LibUnicode: Return a String from Unicode normalization 2023-01-15 01:00:20 +00:00
Timothy Flynn
c9056b824e LibJS: Define Value::to_string to convert a Value to a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
afeb7273cc LibJS+Everywhere: Rename Value::to_string to to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
8f5bdce8e7 LibJS: Add initial support for creating PrimitiveStrings with AK::String
This will temporarily bloat the size of PrimitiveString as LibJS is
transitioned to use String throughout, but will make doing so piecemeal
much easier.
2023-01-15 01:00:20 +00:00
Timothy Flynn
0b58748156 LibJS: Define number_to_string to convert a double to a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
8a88d4434f LibJS+LibWeb: Rename number_to_string to number_to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
c79d20be58 LibJS: Define Utf16String::to_utf8 to convert Utf16String to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
4eb5eb2080 LibJS: Rename Utf16String::to_utf8 to to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
ca655f5e7d LibJS: Rename VM::string_cache to deprecated_string_cache
And rename the member variable from m_string_cache to
m_deprecated_string_cache to match.
2023-01-15 01:00:20 +00:00
Timothy Flynn
3a004e8f1a LibJS: Rename PrimitiveString::has_utf8_string to has_deprecated_string
And rename the member variable from m_utf8_string to m_deprecated_string
to match.
2023-01-15 01:00:20 +00:00
Timothy Flynn
79e81e8a15 LibJS: Add ThrowableStringBuilder::to_string to create a new String
This wraps around the base class method to throw an OOM completion.
2023-01-15 01:00:20 +00:00
Timothy Flynn
3ad1f250e7 LibCrypto: Define *BigInteger::to_base to convert big integers to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
0ddc2e1f50 LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecated 2023-01-15 01:00:20 +00:00