Commit graph

1751 commits

Author SHA1 Message Date
Nico Weber
5da9057a8f icc: Extract out_curve_tag() helper function 2023-04-11 18:23:07 +02:00
networkException
9915fa72fb AK+Everywhere: Use Optional for URLParser::parse's base_url parameter 2023-04-11 16:28:20 +02:00
Tim Schumacher
605b4e96a8 readelf: Pledge map_fixed for loading ELFs 2023-04-11 06:45:08 -04:00
Rodrigo Tobar
41fa1a1461 Utilities: Add more commands, addresses, spaces, cmdline parsing to sed
The initial version of sed implements only the `s` command (given on the
command line) applied to all lines of the input file. While this is
probably the most common scenario that people use sed with in the wild,
it's limited in several ways:

 * `s` is only one of the many commands that sed is meant to implement.
 * Commands may take one or two addresses that limits its applicability
   to input lines.
 * Commands in general operate over the "pattern" and "hold" spaces
   rather than blindly over input lines.
 * Command line parameters include specifying a script file, and
   optionally input file(s) and/or a script to execute.

This commit implements a big portion of these missing features:

 * It adds support for parsing *almost* all commands and their
   arguments.
 * It also implements the execution of a big portion of the commands.
 * It adds support for parsing the optional addresses that prefix a
   command, and enables/disables commands based on these address ranges.
 * It implements the pattern and hold spaces, which are the source of
   input/output for most of the commands.
 * It improves the command line argument handling to receive a script
   file, potentially multiple execution scripts, and optional input
   files.

Some know missing functionality:

 * The `{` and `}` commands are not supported yet.
 * Pattern-based addresses are not supported yet.
 * Labels and branches are parsed, but not supported at runtime.
2023-04-09 18:09:23 -06:00
Ben Wiederhake
560133a0c6 Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
Tim Schumacher
9b4b12f133 tar: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
Tim Schumacher
081cd9f9af lzcat: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
Tim Schumacher
3ec513ecf2 xzcat: Use BufferedFile for reading inputs
This improves the decompression time of `clang-15.0.7.src.tar.xz` from
41 seconds down to about 5 seconds.

The reason for this very significant improvement is that LZMA, the
underlying compression of XZ, fills its range decompressor one byte at a
time, causing a lot of overhead at the syscall barrier.
2023-04-05 07:30:38 -04:00
Andreas Kling
b98f537f11 Kernel+Userland: Make some of the POSIX types larger
Expand the following types from 32-bit to 64-bit:
- blkcnt_t
- blksize_t
- dev_t
- nlink_t
- suseconds_t
- clock_t

This matches their size on other 64-bit systems.
2023-04-04 10:33:42 +02:00
Timothy Flynn
15532df83d AK+Everywhere: Change AK::fill_with_random to accept a Bytes object
Rather than the very C-like API we currently have, accepting a void* and
a length, let's take a Bytes object instead. In almost all existing
cases, the compiler figures out the length.
2023-04-03 15:53:49 +02:00
Eli Youngs
9bc45c0ae8 grep: Read patterns from a file with -f 2023-04-01 13:49:47 -06:00
Timothy Flynn
da6f32e5d8 gzip: Use utilities from LibCompress to (de)compress files 2023-04-01 08:15:49 +02:00
Timothy Flynn
857f559a06 gunzip+LibCompress: Move utility to decompress files to GzipDecompressor
This is to allow re-using this method (and any optimization it receives)
by other utilities, like gzip.
2023-04-01 08:15:49 +02:00
Pankaj Raghav
14e75ed721 disk_benchmark: Remove the call to umask
Calling umask and open with same permission value will result in a file
with no permissions bits if the program is stopped while it is doing an
IO. This will result in an error with EACCES when we try to run the
benchmark with the same file name. The file needs to be manually
removed before continuing the benchmark.

There is no use in calling umask here, so just remove it so that
interrupting the program while it is doing an IO will not result int the
file with no permissions the next time we run the program.
2023-03-31 09:43:00 +02:00
Timothy Flynn
9f238793e0 gunzip+LibCompress: Increase buffer sizes used by Deflate and gunzip
Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-03-31 06:56:11 +02:00
Timothy Flynn
13bc999173 gunzip: Use a buffered file to read from the input file 2023-03-29 07:19:14 +02:00
Andreas Kling
71bdee2837 headless-browser: Don't print extra newline after layout tree dumps
The layout tree dump text already contains a final newline, so we don't
need to use outln() and add an extra one.
2023-03-25 19:41:31 +01:00
Lucas CHOLLET
496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Timothy Flynn
f8b6369c23 WebContent+Everywhere: Add a WebContent IPC to activate a tab 2023-03-21 09:39:49 +00:00
Timothy Flynn
e6fc35897f WebContent+Everywhere: Add an option to not activate new tabs over IPC
WebDriver, for example, will want to create new tabs without activating
them.
2023-03-21 09:39:49 +00:00
Tim Schumacher
16cb127c0b tar: Add partial support for XZ-compressed archives :^) 2023-03-21 10:25:13 +01:00
Tim Schumacher
a61c120b3f Utilities: Add an xzcat utility 2023-03-21 10:25:13 +01:00
Tim Schumacher
df30fd6232 tar: Add partial support for LZMA-compressed archives 2023-03-20 12:15:38 +02:00
Tim Schumacher
858c44ae1b Utilities: Add an lzcat utility 2023-03-20 12:15:38 +02:00
Tim Schumacher
f7dc4396c8 grep: Remove a leftover debug line 2023-03-20 09:33:30 +01:00
kleines Filmröllchen
9ff01723ba Userland: Use more common WAV MIME type
There is no official IANA MIME type for WAV (see
https://www.iana.org/assignments/media-types/media-types.xhtml#audio),
so this will always be subjective. While
https://www.rfc-editor.org/rfc/rfc2361 suggests audio/vnd.wave, we use
audio/wav since that seems to be most common across the internet.
2023-03-17 22:20:16 +00:00
Timothy Flynn
13dfadba79 LibJS: Propagate errors from VM creation 2023-03-17 16:39:08 +00:00
Aliaksandr Kalenik
a9f8d4eada LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tab 2023-03-16 13:17:37 -04:00
Timothy Flynn
700ad6bf35 WebContent+LibWebView: Consolidate the way browsers connect to WebDriver
Currently, on Serenity, we connect to WebDriver from the browser-side of
the WebContent connection for both Browser and headless-browser.

On Lagom, we connect from within the WebContent process itself, signaled
by a command line flag.

This patch changes Lagom browsers to connect to WebDriver the same way
that Serenity browsers do. This will ensure we can do other initializers
in the same order across all platforms and browsers.
2023-03-16 15:02:41 +00:00
Nico Weber
3a7257c9fe image: Don't just crash when the input file can't be decoded
If the input file didn't exist at all, the TRY(MappedFile::map())
gives us a (cryptic) error message, but if it existed but wasn't an
image file, we would crash. Now we print a message instead.
2023-03-16 10:18:44 -04:00
Nico Weber
0591aa1d96 image: Add --assign-color-profile= flag
This allows assigning a color profile from a .icc file to the output.
No pixel data conversion is taking place: the output will just contain
this profile, so it better matches the image data already.
2023-03-16 10:18:44 -04:00
Nico Weber
e05bb47134 image: Add --strip-color-profile flag
With this flag, no color profile is copied from the source image
to the destination image.
2023-03-16 10:18:44 -04:00
Liav A
d16d805d96 Kernel: Merge {get,set}_process_name syscalls to the prctl syscall
It makes much more sense to have these actions being performed via the
prctl syscall, as they both require 2 plain arguments to be passed to
the syscall layer, and in contrast to most syscalls, we don't get in
these removed syscalls an automatic representation of Userspace<T>, but
two FlatPtr(s) to perform casting on them in the prctl syscall which is
suited to what has been done in the removed syscalls.

Also, it makes sense to have these actions in the prctl syscall, because
they are strongly related to the process control concept of the prctl
syscall.
2023-03-15 20:10:48 +01:00
Nico Weber
871a528f4d image: Preserve ICC profiles in BMP output 2023-03-15 13:54:09 +00:00
Nico Weber
76d8e5d866 image: Make the ppm writing code a tiny bit shorter 2023-03-15 11:02:41 +00:00
Nico Weber
fbc70eca93 image: Preserve ICC profiles in PNG output
This probably does strange things for CMYK jpegs, since JPEGLoader
converts those from CMYK to RGB but the ICC profile is still an CMYK
profile. The Right Fix for that is probably for JPEGLoader to consume
the profile when it does CMYK->RGB conversion and then not hand out
the profile data. (Or we could add a CMYK bitmap type.)

But most of the time, this is a progression :^)
2023-03-15 11:02:41 +00:00
Timothy Flynn
97536e4684 LibWeb+Ladybird+Userland: Port window.[alert,confirm,prompt] to String
LibGUI and WebDriver (read: JSON) API boundaries use DeprecatedString,
so that is as far as these changes can reach.

The one change which isn't just a DeprecatedString to String replacement
is handling the "null" prompt response. We previously checked for the
null DeprecatedString, whereas we now represent this as an empty
Optional<String>.
2023-03-13 22:05:22 +00:00
kleines Filmröllchen
0563048949 file: Read more metadata from audio files
We can always read the basic format information (sample rate, bit depth,
etc.), but we will also print artist, album, and title if available in
the metadata.
2023-03-13 12:35:17 -04:00
Tim Schumacher
ae51c1821c Everywhere: Remove unintentional partial stream reads and writes 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
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
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
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
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