Commit graph

48006 commits

Author SHA1 Message Date
Daniel Bertalan
59ba94a2d2 Documentation: Add a note about running on Apple Silicon 2023-03-13 17:02:56 +01:00
Tim Schumacher
ae51c1821c Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
Tim Schumacher
26516ee160 LibSQL: Always read and write entire heap blocks 2023-03-13 15:16:20 +00:00
Tim Schumacher
ba354fa396 LibCore: Use length-checking stream reads and writes for SOCKS5 2023-03-13 15:16:20 +00:00
Tim Schumacher
8032724574 CodeGenerators: Ensure that we always print the entire generated output 2023-03-13 15:16:20 +00:00
Tim Schumacher
e007279315 AK: Read and write accumulated BitStream bits directly 2023-03-13 15:16:20 +00:00
Tim Schumacher
424df62b00 LibAudio: Read FLAC MD5 directly into the class member 2023-03-13 15:16:20 +00:00
Tim Schumacher
26ba195cf6 LibArchive: Read Tar archive headers through read_value 2023-03-13 15:16:20 +00:00
Tim Schumacher
b623dda765 AK: Remove unneeded overrides for write_until_depleted from BitStream 2023-03-13 15:16:20 +00:00
Tim Schumacher
ecd1862859 AK: Rename Stream::write_entire_buffer to Stream::write_until_depleted
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher
a3f73e7d85 AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher
d5871f5717 AK: Rename Stream::{read,write} to Stream::{read_some,write_some}
Similar to POSIX read, the basic read and write functions of AK::Stream
do not have a lower limit of how much data they read or write (apart
from "none at all").

Rename the functions to "read some [data]" and "write some [data]" (with
"data" being omitted, since everything here is reading and writing data)
to make them sufficiently distinct from the functions that ensure to
use the entire buffer (which should be the go-to function for most
usages).

No functional changes, just a lot of new FIXMEs.
2023-03-13 15:16:20 +00:00
Timothy Flynn
1d5b45f7d9 AK: Compute UTF-8 code point lengths using only leading bytes
We don't need to decode the entire code point to know its length. This
reduces the runtime of decoding a string containing 5 million instances
of U+10FFFF from over 4 seconds to 0.9 seconds.
2023-03-13 15:16:02 +00:00
Lucas CHOLLET
516d2f4892 image: Add an argument to choose to write PPMs in binary or in ASCII 2023-03-13 15:15:41 +00:00
Lucas CHOLLET
13d1721852 image: Support writing to PPM files 2023-03-13 15:15:41 +00:00
Lucas CHOLLET
9c9bd271c8 LibGfx/PortableFormat: Add PortableFormatWriter
Currently, the encoder only output ppm files, but it can easily be
extended to support both PBM and PGM.
2023-03-13 15:15:41 +00:00
Andrew Kaster
e32267c902 Documentation: Add query-driver to clangd arguments in NvimConfiguration 2023-03-13 08:00:09 -06:00
Andrew Kaster
ad5db213ca Documentation: Update VS Code docs for tone, add query-driver directions 2023-03-13 08:00:09 -06:00
kleines Filmröllchen
e20038a04b LibAudio+Piano: Correct header style 2023-03-13 13:59:41 +00:00
Fabian Dellwing
7448db9940 Ports: Add lrzip port 2023-03-13 13:53:58 +01:00
Timothy Flynn
50cef4708c Ladybird: Remove the mode to dump the layout tree
This use case is now handled by headless-browser.
2023-03-13 12:41:10 +00:00
Timothy Flynn
127d2e2098 LibWeb: Run LibWeb layout tests using headless-browser 2023-03-13 12:41:10 +00:00
Timothy Flynn
7090f74524 headless-browser: Add a mode to dump the layout tree after load finish 2023-03-13 12:41:10 +00:00
Timothy Flynn
2845a8e139 headless-browser: Support loading local file:// URLs 2023-03-13 12:41:10 +00:00
Timothy Flynn
31bdd8a918 headless-browser: Massage URLs a bit before loading
This is to mimic what Ladybird and Browser do before trying to load the
URL.
2023-03-13 12:41:10 +00:00
kleines Filmröllchen
4420e48dc3 LibAudio: Use symbolic constants for MP3 frame and granule size 2023-03-13 13:25:42 +01:00
kleines Filmröllchen
264cc76ab4 LibAudio: Move audio stream buffering into the loader
Before, some loader plugins implemented their own buffering (FLAC&MP3),
some didn't require any (WAV), and some didn't buffer at all (QOA). This
meant that in practice, while you could load arbitrary amounts of
samples from some loader plugins, you couldn't do that with some others.
Also, it was ill-defined how many samples you would actually get back
from a get_more_samples call.

This commit fixes that by introducing a layer of abstraction between the
loader and its plugins (because that's the whole point of having the
extra class!). The plugins now only implement a load_chunks() function,
which is much simpler to implement and allows plugins to play fast and
loose with what they actually return. Basically, they can return many
chunks of samples, where one chunk is simply a convenient block of
samples to load. In fact, some loaders such as FLAC and QOA have
separate internal functions for loading exactly one chunk. The loaders
*should* load as many chunks as necessary for the sample count to be
reached or surpassed (the latter simplifies loading loops in the
implementations, since you don't need to know how large your next chunk
is going to be; a problem for e.g. FLAC). If a plugin has no problems
returning data of arbitrary size (currently WAV), it can return a single
chunk that exactly (or roughly) matches the requested sample count. If a
plugin is at the stream end, it can also return less samples than was
requested! The loader can handle all of these cases and may call into
load_chunk multiple times. If the plugin returns an empty chunk list (or
only empty chunks; again, they can play fast and loose), the loader
takes that as a stream end signal. Otherwise, the loader will always
return exactly as many samples as the user requested. Buffering is
handled by the loader, allowing any underlying plugin to deal with any
weird sample count requirement the user throws at it (looking at you,
SoundPlayer!).

This (not accidentally!) makes QOA work in SoundPlayer.
2023-03-13 13:25:42 +01:00
kleines Filmröllchen
d707c0a2f5 LibGUI: Make thumbnail generation resilient between FileSystemModels
With the new canceled background actions, some thumbnail generation
callbacks are not executed if the user closes the window with a
FileSystemModel quickly enough. Therefore, we remember which thumbnails
we started to generate and consider the associated promises if we're
looking up a thumbnail. Since the thumbnail generation itself continues
running and the cache is application-global, instead of never displaying
thumbnails for images that were "interrupted" generating thumbnails the
first time, we can now fetch their images immediately and reliably.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
cf1fa419ab LibThreading: Register BackgroundAction with EventLoop
BackgroundActions are now added as a job to the event loop, therefore
they get canceled when the loop exits and their on_complete action never
runs. This fixes all UAF bugs related to BackgroundAction's use of
EventLoops, as seen with e.g. thumbnail generation.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
8f4d0d3797 LibCore+Userland: Make Promise's on_resolve fallible
This will be primarily necessary for BackgroundAction integration, but
it already allows us to add proper error handling in LibIMAP :^)
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
dc318d3080 LibCore: Add a constructor that sets the parent object 2023-03-13 12:12:17 +00:00
kleines Filmröllchen
30295bd988 LibCore: Allow EventLoop to manage and cancel promises
In this context, the promises are considered "jobs", and such jobs
depend in some way on the event loop. Therefore, they can be added to
the event loop, and the event loop will cancel all of its pending jobs
when it ends.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
bfd9f681f7 LibCore+Userland: Allow canceling promises
To make EventLoop cancel its managed Promises, we need the ability to
cancel them in the first place.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
afd0f941b7 LibCore: Add Promise to the forward declare header 2023-03-13 12:12:17 +00:00
Tim Ledbetter
82219d0879 Base: Add missing options to sort man page 2023-03-13 07:53:24 +00:00
Tim Ledbetter
0454d655bb sort: Add an option to sort in reverse order
Lines can now be sorted in reverse order by specifying the `-r` option.
2023-03-13 07:53:24 +00:00
Timothy Flynn
f5f1a5228e LibWeb: Escape HTML text fragments with multi-byte code point awareness
The UTF-8 encoding of U+00A0 (NBSP) is the bytes 0xc2 0xa0. By looping
over the string to escape byte-by-byte, we replace the second byte with
" ", but leave the first byte in the resulting text. This creates
an invalid UTF-8 string, with a lone leading byte.
2023-03-13 07:29:40 +00:00
Andrew Kaster
3219ecbdc0 Ports: Add port of backward-cpp, a pretty backtrace library 2023-03-13 07:23:53 +00:00
Andrew Kaster
e690b35fdc Ports: Install libiberty from binutils port
Normally this is supposed to be installed from gdb or gcc. If a port
wants to link against libbfd though, we need to make sure libiberty is
actually available in the root filesytem without requiring the port to
depend on those larger packages.
2023-03-13 07:23:53 +00:00
Andrew Kaster
6ce7257ad7 Kernel: Don't include Kernel/Arch/RegisterState from userspace
Any userspace cpp file that included <syscall.h> would end up with
a large glob of Kernel headers included, all the way down to
Kernel/Arch/x86_64/CPU.h and friends.

Only the kernel needs RegisterState, so hide it from userspace.
2023-03-13 07:23:53 +00:00
Timothy Flynn
11fe34ce0f headless-browser: Re-implement headless-browser using an OOPWV
headless-browser currently uses its own PageClient to load web pages
in-process. Due to this, it also needs to set up a whole bunch of other
objects needed to run LibWeb, e.g. image decoders, request servers, etc.

This changes headless-browser to instead implement a WebView to launch
WebContent out-of-process. This implementation is almost entirely empty,
but can be filled in as-needed. For example, we may want to print
JavaScript console messages.
2023-03-13 07:21:00 +00:00
Timothy Flynn
add15a5f04 Ladybird+LibWebView: Move WebContent process launcher to LibWebView
This is to allow headless-browser to reuse this code. We have a similar
helper for launching SQLServer from Ladybird.
2023-03-13 07:21:00 +00:00
Karol Baraniecki
be4da57004 Base: Make keyboard keys in the BrickGame manual and Help page stand out
by making them `monospace` in the Help page, and bold in the manual.
This helps to quickly find out where the keyboard controls are in the
manual when skimming its contents.
2023-03-13 06:43:59 +00:00
Karol Baraniecki
d4d625b58e Base: Document Escape and P pausing/unpausing BrickGame 2023-03-13 06:43:59 +00:00
Karol Baraniecki
ddac8192e3 BrickGame: Add a "Pause" option to the Game menu
This is how the menu looks like after this commit:
┌────┐
│Game│ Help
├────┴─────────────────────────────┐
│   New game                   F2  │
│   Toggle pause                P  │
├──────────────────────────────────┤
│   Quit                   Alt+F4  │
└──────────────────────────────────┘
2023-03-13 06:43:59 +00:00
Karol Baraniecki
a337557658 BrickGame: Show a box with "Paused" in it when the game is paused
Looks a bit like this:

  ┌────────────┐
  │            │
  │   Paused   │
  │            │
  └────────────┘
2023-03-13 06:43:59 +00:00
Karol Baraniecki
1fd61d2af3 BrickGame: Disallow manual piece movement while paused
This make the pause feature feel much better.
2023-03-13 06:43:59 +00:00
Karol Baraniecki
06a9e4280b BrickGame: Stop bricks from falling when paused
Allows for pausing with either the `P` or `Escape` keys. In this commit
you can still rotate pieces when paused - which makes for an interesting
"stop-time" cheat mechanic, but probably isn't yet what we want.
2023-03-13 06:43:59 +00:00
Nico Weber
dfb45705e6 LibCompress: Make DeflateCompressor::write() use loop, not recursion
This is performance-neutral, but Instruments.app had a hard time
visualizing the very deeply nested stack frames here.

No behavior change.
2023-03-13 06:32:56 +00:00
Nico Weber
e26aebca4f SpiceAgent: Remove unused BMPWriter.h include 2023-03-12 22:09:34 +01:00