We don't need nanosecond precision here anyways, as we only display
millisecond resolution.
This uses our simple duration formatter from AK, which is updated to
accept a Duration here. This method did not have any users after the
move from Serenity.
Before this change, a StringView with a character-data pointer would
never compare as equal to one with a null pointer, even if they were
both length 0. This could happen for example if one is
default-initialized, and the other is created as a substring.
Supported:
* Normal absolute and relative paths: C:\Windows\Fonts, AK\LexicalPath.h
* Forward slashes and multiple separators: C:/Windows///\\\notepad.exe
Not supported:
* Paths starting with two backslashes: \\?\C:\Windows, \\server\share
* Unusual relative paths like C:, C:a\b, \, \a\b
More on Windows path formats: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
Lines like these were getting a warning to simplify the expanded
boolean expression from `!(a || b)` to `(a && b)`, but since the
`!(...)` is part of the macro, that is never going to happen.
This adds the vcpkg triplets and CMake preset to perform release
builds for distribution. These builds are fully static, and currently
intended to be used for the `js` ESVU release.
In the future, linking everything statically into the final binary is
probably not what we will do for released Ladybird builds. Instead, we
may have a "libladybird.so", which is then linked into the binary. But
this should be fine for `js` for now.
Using install(IMPORTED_RUNTIME_ARTIFACTS), we can re-export the
shared library and frameworks we imported from outside the build
tree into our install treer. This is required for simdutf as it
is a dependency of the AK library, and we need liblagom-ak.so to
be loadable when doing fuzzer and cross-compile builds for the
Lagom tools.
It is a non-null `T*` with reference semantics.
Or a `T&` whose address can be copied and re-assigned.
Or a `NonnullRefPtr` whose memory is not managed.
It can be useful when you want to store a reference in a
data structure that needs to be copyable or assignable.
`Optional` and `Variant` both use essentially the same pattern of only
declaring a copy constructor/move constructor/destructor and copy/move
assignment operator if all of their template parameters have one.
Let's move these into a macro to avoid code duplication and to give a
name to the thing we are trying to accomplish.
The specialization for the destructor of `AK::Optional` is ambiguous
when `T` is neither TriviallyDestructible nor Destructible.
The fix adds an additional check for `Destructible` when generating the
destructor of `AK::Optional`, since it calls the destructor of `T`, and
therefore already required `T` to be `Destructible` anyway.
Attempting this resulted in an error because the `m_pointer` field does
not exist on `Optional<T>`. Creating a shared `ptr()` function and
adding the necessairy overloads solves this issue.
The order of precedence with the `*` operator sometimes makes it a bit
harder to detect whether or not the result is actually used. Let's fail
compilation if anyone tries to discard the result.
MSG_NOSIGNAL is a no-op for Windows, so we can define it to 0.
At the same *time*, none of the CLOCK_* macros are defined on
Windows, as clock_gettime does not exist. Put AK_OS_WINDOWS in the
same category of the BSDs for the COARSE versions of those macros.
Co-authored-by: Andrew Kaster <akaster@serenityos.org>
Monotonic uses QueryPerformanceCounter, while realtime uses
GetSystemTimeAsFileTime. These should approximate clock_gettime
fairly accurately. The QPC implementation only grabs microseconds,
but if we have actual use cases for nanos, we can bump that up.
Co-authored-by: Andrew Kaster <akaster@serenityos.org>
These don't have to worry about the input not being valid UTF-8 and
so can be infallible (and can even return self if no changes needed.)
We use this instead of Infra::to_ascii_{upper,lower}_case in LibWeb.
`STDERR_FILENO` is pretty common but not part of the standard. On
Windows, in order to get a file number, one must use `_fileno` to
convert the `FILE *` to a file number. Adopt this pattern similar
to the Android path which uses platform specific operations.
We had numerous NiH-based implementations of audio formats and metadata
that we now no longer need because we either don't make use of the code,
or we replaced its implementation by FFmpeg.