Commit graph

1456 commits

Author SHA1 Message Date
Linus Groh 57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Alec Murphy 8677dbfc7f Utilities: Add strings 2022-12-04 12:08:48 +00:00
Linus Groh d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Hendiadyoin1 35db0c5e18 js: Force optimizations when setting the -p flag 2022-12-03 17:07:30 +03:30
Timothy Flynn 0986b383cd SQLServer+SQLStudio+sql: Rename a couple of SQL IPC commands for clarity
Rename sql_statement to prepare_statement and statement_execute to
execute_statement. The former aligns more with other database libraries
(e.g. Java's JDBC prepareStatement). The latter reads less awkwardly.
2022-11-30 11:43:13 +01:00
Tim Schumacher fd3a823a20 LibArchive: Move loading the next tar header into a helper function
This now also validates the first header that is loaded, so we can drop
the corresponding FIXME from `tar`.
2022-11-30 08:03:31 +01:00
Tim Schumacher cbeaba0c12 LibArchive: Use Core::Stream inside TarInputStream 2022-11-30 08:03:31 +01:00
Tim Schumacher 71d1d9e2b5 LibArchive: Port TarFileStream to Core::Stream 2022-11-30 08:03:31 +01:00
Sam Atkins 35126e81c4 profile: Pass the command to run using positional arguments
This changes this:

```sh
profile -c "python3 -m test test_dict"
```

to this:

```sh
profile -- python3 -m test test_dict
```

This should be less confusing, hopefully!
2022-11-29 18:54:27 +01:00
Baitinq 44ef0ac41c shuf: Support the output of a limited number of lines
This patch adds the "-n"/"--head-count" optional argument to specifiy
the maximum number of shuffled lines to output.

Idea from Andreas' FIXME roulette :^)
2022-11-29 11:44:05 +01:00
Ali Mohammad Pur c590c5c444 js: Make console.log() print to stdout again
This was broken in 84502f53b5.
2022-11-28 14:32:27 +01:00
Liav A 8e16588757 Utilities+Base: Add unveil utility
This utility essentially creates a filesystem sandbox for a specified
command, so it can be tested with only the unveiled paths the user
specifies beforehand.
2022-11-26 12:42:15 -07:00
Simon Wanner 6b5e4cdfbc disasm: Demangle symbols 2022-11-26 12:50:38 +01:00
Simon Wanner 4076619655 disasm: Print virtual offsets with pointer semantics
Instead of assuming the virtual offset will be 8 hex digits (which is OK
for 32 bit values), just use the ":p" modifier to ensure it prints the
virtual offset as a pointer, so if the code is compiled for 64 bit CPUs,
it will use 16 hex digits accordingly.
2022-11-26 12:50:38 +01:00
Eli Youngs 7cd43deb28 hexdump: Replace Core::File with Core::Stream::File
Previously, hexdump used Core::File to read input into a fixed buffer.
This PR rewrites the file handling to use the more modern
Core::Stream::File, which reads data into spans. By using spans, we
can also simplify the rest of the code, which previously used memcpy
for array manipulation and relied on manual bookkeeping to keep track of
offsets.
2022-11-26 11:07:00 +01:00
Baitinq 45214fdb1a LibWeb+WebContent: Label redirects with new FrameLoader::Type::Redirect
Previously we labeled redirects as normal FrameLoader::Type::Navigation,
now we introduce a new FrameLoader::Type::Redirect and label redirects
with it. This will allow us to handle redirects in the browser
differently (such as for overwritting the latest history entry when a
redirect happens) :^)
2022-11-26 11:03:24 +01:00
Liav A 9f571e0dae Userland: Enhance jail-attach utility to support existing and new jails
The Core::System::create_jail function already provided the new jail
index as a result, so it was just a matter of using it when calling the
LibCore join_jail function to use the new jail.
2022-11-26 01:47:50 -07:00
implicitfield 19e6befddc FuzzTar+tar: Advance the stream before continuing
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53733
This bug was caused by a regression introduced in c88d8a2.
2022-11-26 01:24:12 +01:00
kleines Filmröllchen c948777ec4 aplay: Preload more audio
This reduces glitching, but it is in no way a good solution. We should
really do the loading on another thread, but that's out of scope.
2022-11-25 17:01:44 -07:00
kleines Filmröllchen 9b819a0dc9 LibAudio: Set asynchronous audio enqueuer thread to maximum priority
Anything that handles audio in this way should run at maximum priority.
2022-11-25 17:01:44 -07:00
Ali Mohammad Pur 84502f53b5 LibJS+js: Move the value print implementation to LibJS
And make it capable of printing to any Core::Stream.
This is useful on its own and can be used in a number of places, so move
it out and make it available as JS::print().
2022-11-26 02:23:15 +03:30
Zaggy1024 f6830eaf73 LibVideo: Implement Matroska Cues for faster keyframe lookup
This implements the fastest seeking mode available for tracks with cues
using an array of cue points for each track. It approximates the index
based on the seeking timestamp and then finds the earliest cue point
before the timestamp. The approximation assumes that cues will be on
a regular interval, which I don't believe is always the case, but it
should at least be faster than iterating the whole set of cue points
each time.

Cues are stored per track, but most videos will only have cue points
for the video track(s) that are present. For now, this assumes that it
should only seek based on the cue points for the selected track. To
seek audio in a video file, we should copy the seeked iterator over to
the audio track's iterator after seeking is complete. The iterator will
then skip to the next audio block.
2022-11-25 23:28:39 +01:00
Zaggy1024 56d8b96c78 Utilities/matroska: Add arguments to print specific details
This adds two options:
- An option to print a specific track number only, and omit all others.
- An option to print each block for each track that is printed.
2022-11-25 23:28:39 +01:00
Zaggy1024 a58bf7c3d1 LibVideo: Calculate Block timestamps for Matroska according to spec
Tracks have a timestamp scale value that should be present which scales
each block's timestamp offset to allow video to be synced with audio.
They should also contain a CodecDelay element and may also contain a
TrackOffset that offsets the block timestamps.
2022-11-25 23:28:39 +01:00
Zaggy1024 9040194d54 LibVideo: Make Matroska Block and Cluster timestamps absolute 2022-11-25 23:28:39 +01:00
Zaggy1024 393cfdd5c5 LibVideo: Read Matroska lazily so that large files can start quickly
The Demuxer class was changed to return errors for more functions so
that all of the underlying reading can be done lazily. Other than that,
the demuxer interface is unchanged, and only the underlying reader was
modified.

The MatroskaDocument class is no more, and MatroskaReader's getter
functions replace it. Every MatroskaReader getter beyond the Segment
element's position is parsed lazily from the file as needed. This means
that all getter functions can return DecoderErrors which must be
handled by callers.
2022-11-25 23:28:39 +01:00
Zaggy1024 2dfd236dcd LibVideo: Propagate decoder errors in the Matroska Reader
Matroska::Reader functions now return DecoderErrorOr instead of values
being declared Optional. Useful errors can be handled by the users of
the parser, similarly to the VP9 decoder. A lot of the error checking
in the reader is a lot cleaner thanks to this change, since all reads
can be range checked in Streamer::read_octet() now.

Most functions for the Streamer class are now also out-of-line in
Reader.cpp now instead of residing in the header.
2022-11-25 23:28:39 +01:00
Zaggy1024 9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00
Eli Youngs c92f450ff0 shuf: Support splitting on null bytes with -z 2022-11-25 22:59:27 +01:00
Eli Youngs b2fd87950a shuf: Support reading input from a file
Previously, shuf exclusively read input from stdin. This PR adds an
option to read from a file using Core::Stream::File. Since a file might
contain arbitrary bytes, including null bytes, this PR represents lines
as Spans of Bytes instead of Strings.
2022-11-25 22:59:27 +01:00
Lucas CHOLLET 1944e8936d cat: Return a non-null value if an error occurred 2022-11-24 21:01:54 -05:00
Lucas CHOLLET 71c9da90b6 cat: Use Core::Stream::File 2022-11-24 21:01:54 -05:00
Andreas Kling f8290e1ad4 stat: Show nanosecond part of file timestamps 2022-11-24 16:56:27 +01:00
Timothy Flynn e840d27d8e headless-browser: Add a mode for being controlled by WebDriver
This adds command line flags for WebDriver to pass its IPC socket path
(if running on Serenity) or its FD passing socket (if running elsewhere)
for the headless-browser to connect to.
2022-11-24 00:10:56 +00:00
Timothy Flynn c917a59abe LibWeb+WebContent: Virtualize PageClient methods needed for all clients 2022-11-24 00:10:56 +00:00
Timothy Flynn 1f08cb7020 LibWeb+WebContent: Move pending dialog handling from PageHost to Page
Currently, all handling of pending dialogs occurs in PageHost. In order
to re-use this functionality to run WebDriver in a headless move, move
it to Page.
2022-11-24 00:10:56 +00:00
Andreas Kling 15c324a70b Userland+Tests: Remove a few more LibJS/{AST.h,Parser.h} includes 2022-11-23 16:05:59 +00:00
implicitfield ee0c9ed87b LibArchive: Simplify error handling 2022-11-23 11:19:16 +01:00
Sam Atkins c279fd1097 cksum: Manually count file size instead of using stat()
`stat()` doesn't work for stdin, but this does.
2022-11-19 17:00:10 +00:00
Sam Atkins b8a1d04a49 xml: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins fde9cba2a0 Utilities/w: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 8d798c2716 utmpupdate: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 6d7435d251 test-fuzz: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins f7fa88976f sysctl: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 722879e2b9 strace: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 4c3d2267db sql: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins f22d7ddd98 shot: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 84e817a9f2 route: Port to Core::Stream 2022-11-19 17:00:10 +00:00
Sam Atkins 97ef1ac260 pmap: Port to Core::Stream 2022-11-19 17:00:10 +00:00