Commit graph

29833 commits

Author SHA1 Message Date
Simon Woertz
1476f02f99 SoundPlayer: Fix stack-use-after-scope when playing file in loop mode
The path returned by GUI:FilePicker is stored on the stack when the
callback is executed. The player only stored a StringView to the path
however it should take ownership of the path instead since the path is
accessed even after the file menu open action has returned.
2021-11-08 16:34:03 -08:00
Brendan Coles
1e48cd35a1 UserspaceEmulator: Add support for SC_uname and SC_sysconf syscalls 2021-11-08 16:30:32 -08:00
kleines Filmröllchen
61d9082da6 LibAudio: Replace log_pan with a constant power panning algoritm
This little functional change uses the most common algorithm for panning
audio, known as constant power panning. It makes it so that the total
output power (not directly the sample value, i.e. the peak) stays the
same no matter how the audio is panned.
2021-11-08 16:29:25 -08:00
kleines Filmröllchen
8945cc8358 LibAudio: Improve local variable names
This makes the code easier to read.
2021-11-08 16:29:25 -08:00
David Isaksson
b6d075bb01 LibAudio: Rename Audio::Frame -> Audio::Sample
"Frame" is an MPEG term, which is not only unintuitive but also
overloaded with different meaning by other codecs (e.g. FLAC).
Therefore, use the standard term Sample for the central audio structure.

The class is also extracted to its own file, because it's becoming quite
large. Bundling these two changes means not distributing similar
modifications (changing names and paths) across commits.

Co-authored-by: kleines Filmröllchen <malu.bertsch@gmail.com>
2021-11-08 16:29:25 -08:00
David Isaksson
fa4255bcf1 LibAudio: Refactor out linear_to_log function and add its inverse
The conversion from a linear scale (how we think about audio) to a
logarithmic scale (how audio actually works) will be useful for other
operations, so let's extract it to its own utility function. Its inverse
will also allow reversible operations to be written more easily.
2021-11-08 16:29:25 -08:00
Linus Groh
1e3e0477cb LibJS: Implement Temporal.PlainMonthDay.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
fa1d5feec0 LibJS: Implement Temporal.PlainYearMonth.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
aca2ef9e1c LibJS: Implement Temporal.PlainDateTime.prototype.with() 2021-11-08 22:19:45 +00:00
Linus Groh
c3c9ac93d0 LibJS: Implement Temporal.PlainDate.prototype.with()
With one caveat: in the PreparePartialTemporalFields AO I made a change
to fix a spec issue that would require the input object to always have a
month or monthCode property.
This is tracked in https://github.com/tc39/proposal-temporal/issues/1910
and may get accepted as-is, in which case we simply need to remove the
NOTE comment.
2021-11-08 22:19:45 +00:00
Linus Groh
310016aee4 LibJS/Tests: Fix Temporal.PlainDate.prototype.equals() tests
Just calling "expect()" doesn't do anything!
2021-11-08 19:12:54 +00:00
Linus Groh
46d7c34028 LibJS: Use StringView literals in prepare_temporal_fields() 2021-11-08 19:12:47 +00:00
Tim Schumacher
22562b4b17 CMake: Assume working compiler instead of using static linking
We were previously using TRY_COMPILE_TARGET_TYPE to bypass the compiler
check at the beginning of the CMake build, since we don't have LibC
available and therefore can't link at that point.

However, this breaks a lot of assumptions in try_compile when it comes
to library checks. While this was the main idea behind our usage of the
flag, it also has some really nasty side effects when software wants
to find out what library a symbol is in.

Instead, just manually tell CMake that our compiler works as intended
and keep the target type setting at its default.
2021-11-07 20:11:23 -08:00
Daniel Bertalan
20bea3feff LibC: Fix huge libc.a file size due to the use of llvm-ar -q
Before this change, we would generate the static C library by running
the command `ar -qcs` to collect the various `*.o` files into a single
archive.

The `q` option stands for "quick append", which simply appends new files
to the archive, without replacing any pre-existing entries for the same
file. The problem with this is obvious: each LibC rebuild would add
approximately 1 MB (the size of a cleanly built libc.a) to the size of
the file. It got so bad on my machine that the total file size ended up
being 3 gigabytes.

Note that this did not affect the GNU toolchain, because, as the `ar(1)`
manpage says:
> Note - GNU ar treats the command qs as a synonym for r - replacing
> already existing files in the archive and appending new ones at the
> end.
2021-11-08 01:39:07 +01:00
Daniel Bertalan
05cb72e2c3 Ports: Unbreak and update oksh
This port has been broken since the introduction of `sys_signame` (which
was almost 3 months ago), as oksh provided a conflicting definition for
it.

This commit also cleans up some of the patches, defining the appropriate
config macro instead of commenting out code.

When I opened this program's GitHub releases page, I noticed that a new
version was available, so I also did the update.
2021-11-08 01:36:54 +01:00
Timothy Flynn
2530b6adf0 LibJS: Create the RegExpExec result's "input" field last
We move the input string into this field to avoid a string copy, so we
must do this step last to avoid using any views into it (note that
match.view here is a view into this string).
2021-11-08 01:36:29 +01:00
Andreas Kling
79fa9765ca Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace!
This was a slightly tedious refactoring that took a long time, so it's
not unlikely that some bugs crept in.

Nevertheless, it does pass basic functionality testing, and it's just
real nice to finally see the same pattern in all contexts. :^)
2021-11-08 01:10:53 +01:00
Andreas Kling
7ee10c6926 AK: Add some more ways to construct Error and ErrorOr<T>
This is preparation for using Error in the kernel instead of KResult.
2021-11-08 00:36:35 +01:00
Andreas Kling
5e473a63d3 AK: Make Error.h pull in Try.h
Users of this API will want TRY().
2021-11-08 00:36:19 +01:00
Andreas Kling
72f3fd824e LibSQL: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
fbe8f185b5 Profiler: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
e841f3c283 AK: Add a variant of adopt_nonnull_own_or_enomem() for userspace
This variant returns ErrorOr<NonnullOwnPtr<T>> instead of KResultOr.
Eventually the KResultOr variant should go away once the kernel adopts
Error and ErrorOr<T>.
2021-11-08 00:35:27 +01:00
Andreas Kling
2c70c479ab LibIPC: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
0b0c4e82b9 LibCore: Replace Result<T, E> use with ErrorOr<T> in Core::FileWatcher 2021-11-08 00:35:27 +01:00
Andreas Kling
4eeab4cfc8 LibCore: Replace Result<T, E> use with ErrorOr<T> in Core::Account 2021-11-08 00:35:27 +01:00
Andreas Kling
01a6a4f7c4 RequestServer: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
fbbb87d517 DHCPClient: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
d1477bcb8e Shell: Replace Result<T, E> use with ErrorOr<T> 2021-11-08 00:35:27 +01:00
Andreas Kling
184810a581 AK: Remove now-unused OSError class
This has been superseded by the more generally useful AK::Error :^)
2021-11-08 00:35:27 +01:00
Andreas Kling
c6cc0a88a1 LibKeyboard: Use ErrorOr<T> for CharacterMap::fetch_system_map() 2021-11-08 00:35:27 +01:00
Andreas Kling
e76b21a66f LibCore: Use ErrorOr<T> for Core::get_password() 2021-11-08 00:35:27 +01:00
Andreas Kling
801d46d02c PixelPaint: Use ErrorOr<T> for Image and Layer creation helpers 2021-11-08 00:35:27 +01:00
Andreas Kling
9268ed9605 PixelPaint: Use ErrorOr<T> for Image::try_compose_bitmap() 2021-11-08 00:35:27 +01:00
Andreas Kling
77fd4625b5 PixelPaint: Use ErrorOr<T> for Image writing/exporting functions 2021-11-08 00:35:27 +01:00
Andreas Kling
a7f1f1c34b LibCore: Use ErrorOr<T> for Core::File::open() 2021-11-08 00:35:27 +01:00
Andreas Kling
fac2550143 LibCore: Use ErrorOr<T> for Core::File::size() 2021-11-08 00:35:27 +01:00
Andreas Kling
4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00
Andreas Kling
c7e62d448c LibCore: Use ErrorOr<T> for Core::File::remove()
This function returns a subclass of Error, which is now possible.
2021-11-08 00:35:27 +01:00
Andreas Kling
e253cf694e AK: Allow subclassing Error 2021-11-08 00:35:27 +01:00
Andreas Kling
b2170c11a4 LibCore: Use ErrorOr<T> for Core::File::link_file() 2021-11-08 00:35:27 +01:00
Andreas Kling
0f5477c721 AK: Use ErrorOr<T> for MappedFile factories
Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
2021-11-08 00:35:27 +01:00
Andreas Kling
c837bd551e AK: Don't define ENABLE_COMPILETIME_FORMAT_CHECK when parsed by CLion 2021-11-08 00:35:27 +01:00
Andreas Kling
880964755b AK: Don't define AK_HAS_CONDITIONALLY_TRIVIAL when parsed by CLion IDE
This feature confuses CLion's parser, so let's turn it off if we see the
__CLION_IDE_ macro as well.
2021-11-08 00:35:27 +01:00
Andreas Kling
202950bb01 AK: Make Error and ErrorOr<T> work in Lagom as well :^)
ErrnoCode is not a thing outside __serenity__, so let's not make
assumptions about it existing.
2021-11-08 00:35:27 +01:00
Andreas Kling
6e255b262f LibGfx: Use ErrorOr<T> for try_create_from_serialized_byte_buffer() 2021-11-08 00:35:27 +01:00
Andreas Kling
0de33b3d6c LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Andreas Kling
16f064d9be LibGfx: Convert Gfx::Bitmap to east const style 2021-11-08 00:35:27 +01:00
Andreas Kling
d85d741c59 LibGfx: Deduplicate code in Bitmap::try_load_from_file()
This can share logic with try_load_from_fd_and_close(), we just need to
open the file first. :^)
2021-11-08 00:35:27 +01:00
Andreas Kling
09cba7c780 LibGfx: Use ErrorOr<T> for Bitmap infrastructure used by ShareableBitmap
This also allows us to get rid of the ShareableBitmap(Bitmap)
constructor which was easy to misuse. Everyone now uses Bitmap's
to_shareable_bitmap() helper instead.
2021-11-08 00:35:27 +01:00