Commit graph

32712 commits

Author SHA1 Message Date
Idan Horowitz
119f900451 Kernel: Use StringView literals instead of empty Strings in ProcFS 2022-01-13 00:20:08 -08:00
Idan Horowitz
0fc25273e4 Kernel: Make Process::dump_perfcore OOM-fallible using KString 2022-01-13 00:20:08 -08:00
Luke Wilde
010a37f997 Ports/HalfLife: Do not delete the OpenGL renderer in post install
We can now play Half-Life using LibGL without crashing on launch! :^)
2022-01-13 10:07:45 +02:00
Luke Wilde
f91e41f90c LibGL: Generate texture in glBindTexture if not previously generated
Required by Xash3D, which forgoes glGenTexture and implements its own
texture generator. It expects glBindTexture to pick up on this though.

The strategy here is to keep texture_object null if we don't find the
texture in the allocation textures map, as it will then both generate
and set the texture in the allocated textures map using the texture
name passed to us, then bind it.
2022-01-13 10:07:45 +02:00
Luke Wilde
53d6e1600c LibGL: Stub glStencilMask
Xash3D requires this otherwise it will crash with a jump to nullptr,
but it doesn't use it for anything interesting and just sets a default
value of ~0 during initialization.
2022-01-13 10:07:45 +02:00
Luke Wilde
cba1972deb LibGL: Implement glTexCoord{1,3,4}f(v)
Not necessarily required by Half-Life's use of Xash3D, but it looks
them up anyway and they're easy to implement, so here they are :^).
2022-01-13 10:07:45 +02:00
Lady Gegga
10a52c0b32 FontEditor: Add Klingon phrase to Preview Font 2022-01-12 22:54:59 +01:00
Linus Groh
cf6ceb956f LibJS: Avoid js_string() allocation in parse_time_zone_offset_string()
No need to take the spec literally here since we know the input values
are guaranteed to be integral numbers. Use AK string to number parsing
functionality instead and save a couple of PrimitiveString allocations.

This matches what we already do in parse_temporal_time_zone_string().
2022-01-12 21:24:12 +01:00
Linus Groh
392f5bfebd LibJS: Fix fraction substring range in parse_temporal_time_zone_string()
Two issues:

- The intended range was 9 characters starting from index 1. Since the
  second argument to String::substring() is the length, 10 is
  potentially reading further than the string's length (when only
  providing one fraction digit), causing an assertion failure crash.
- The spec's intention to skip the decimal separator by starting at
  index 1 is incorrect, no decimal separator is present in the result of
  parsing TimeZoneUTCOffsetFractionalPart. I filed a spec fix for this,
  see: https://github.com/tc39/proposal-temporal/pull/1999
2022-01-12 21:24:12 +01:00
Linus Groh
027e4bd439 LibJS: Fix calculation overflow in parse_temporal_time_zone_string()
As all variables and numeric literals in the expression have an integral
data type, it would evaluate to an int and could easily overflow as
we're multiplying seconds with 10^9.

Introduce a floating point literal into the expression to make it result
in a double.
2022-01-12 21:24:12 +01:00
Linus Groh
323e1e17cf LibJS: Fix sign data type in parse_temporal_time_zone_string()
A sign that's either the value 1 or -1 should obviously not have an
unsigned data type :^)

This would cause it to become 255 for the negative offset case, which
would then completely screw up the offset_nanoseconds calculation as it
serves as a multiplier.
2022-01-12 21:24:12 +01:00
Idan Horowitz
709fe64c1b Revert "Kernel: Use a StringView for Ext2FSDirectoryEntry::name"
This reverts commit d1d24eaef4.

I missed the fact that traverse_as_directory uses a temporary buffer,
meaning that entries created based on its callback will point to free'd
memory.
2022-01-12 21:26:03 +02:00
Marcus Nilsson
a0ba21e442 LibGUI: Print error when failing to load thumbnail in FileSystemModel
If a thumbnail cannot load it's a good opportunity to print out the
error message.
On top of that, we still want to update m_thumbnail_progress so that
the progress bar doesn't get stuck instead of returning early from
the lambda.
2022-01-12 19:44:17 +01:00
Jelle Raaijmakers
263348ff2d Taskbar: Include ScreenLayout.h from Services directory
While trying to include `Desktop.h` for the SDL2 port, compilation
failed on finding this include. Specify the full include path to make
it work.
2022-01-12 20:26:46 +02:00
Timothy Flynn
a121c913c0 LibJS: Add some Intl.DateTimeFormat tests for specific time zones
Now that we can use time zones, let's adds tests for them.
2022-01-12 15:43:12 +01:00
Timothy Flynn
d64ea13565 LibJS: Respect the user-provided time zone in Intl.DateTimeFormat
Also update some DateTimeFormat tests to explicitly set the time zone
(usually to UTC). This was already done for most tests, but some were
missed.
2022-01-12 15:43:12 +01:00
Timothy Flynn
8987deb984 LibJS: Partially implement the LocalTZA AO
Intl.DateTimeFormat will invoke this AO with isUTC=true, so this only
implements that branch in LocalTZA.
2022-01-12 15:43:12 +01:00
Timothy Flynn
f6786881aa LibJS: Implement the ECMA-402 definition of DefaultTimeZone
Simply defer to LibTimeZone to retrieve the system's current time zone.
Also update some Temporal tests to explicitly set the time zone to UTC.
2022-01-12 15:43:12 +01:00
Timothy Flynn
bdf02c21e1 LibUnicode: Swap the preferred order of standard time zone display names
Our generator is currently preferring the DST variant of the time zone
display names over the non-DST variant. LibTimeZone currently does not
have DST support, and operates in a mode that basically assumes DST does
not exist. Swap the display names for now just to be consistent until we
have DST support.

Note we will need to generate both of these variants and select the
appropriate one at runtime once we have DST support.
2022-01-12 15:43:12 +01:00
Timothy Flynn
8a4ac9c387 LibTimeZone: Add an API to retrieve the system's current time zone
This is a wrapper API around the POSIX tzset / tzname information. It
is to help ensure that tzset is invoked before accessing tzname.
2022-01-12 15:43:12 +01:00
Idan Horowitz
9a7cd8fef8 Kernel: Make Thread::backtrace() fallible using KString 2022-01-12 16:09:09 +02:00
Idan Horowitz
06af81fcfb Kernel: Move NonnullRefPtrVector<NVMeQueue>s instead of copying them 2022-01-12 16:09:09 +02:00
Idan Horowitz
4b74f2e3ec Kernel: Convert NVMeNameSpace::try_create() to KString 2022-01-12 16:09:09 +02:00
Idan Horowitz
c92753a686 Kernel: Convert IPv4SocketTuple::to_string() to KString 2022-01-12 16:09:09 +02:00
Idan Horowitz
b84444cbb3 Kernel: Move IPv4SocketTuple into the Kernel namespace
This class was accidentally declared in the global namespace.
2022-01-12 16:09:09 +02:00
Idan Horowitz
bc85b64a38 Kernel: Replace usages of String::formatted with KString in sys$exec 2022-01-12 16:09:09 +02:00
Idan Horowitz
dba0840942 Kernel: Remove outdated FIXME comment in sys$sethostname 2022-01-12 16:09:09 +02:00
Idan Horowitz
e236f9d85a Kernel: Convert Inode event APIs to use StringViews instead of Strings
These APIs allocate a copy internally anyways, so there's no point to
making another one for them.
2022-01-12 16:09:09 +02:00
Idan Horowitz
d1d24eaef4 Kernel: Use a StringView for Ext2FSDirectoryEntry::name
This is a temporary struct, so there's no need to allocate a long term
storage for these strings.
2022-01-12 16:09:09 +02:00
Idan Horowitz
8a4654a924 Kernel: Make PerformanceEventBuffer::add_process fallible with ErrorOr 2022-01-12 16:09:09 +02:00
Idan Horowitz
d2ffcfb762 Kernel: Remove the Custody::absolute_path() API
With the last user removed this non-fallible API can now be removed.
2022-01-12 16:09:09 +02:00
Idan Horowitz
efc61370c0 Kernel: Convert ProcFS Process getters to try_serialize_absolute_path 2022-01-12 16:09:09 +02:00
Idan Horowitz
174056a479 Kernel: Use try_serialize_absolute_path in PerformanceEventBuffer
This only moves the issue, as PerformanceEventBuffer::add_process can't
fail yet, but this will allow us to remove the non-failable
Custody::absolute_path API.
2022-01-12 16:09:09 +02:00
Idan Horowitz
a482f7718d Kernel: Convert CoreDump to KString using try_serialize_absolute_path 2022-01-12 16:09:09 +02:00
Idan Horowitz
eb5f6cd108 Kernel: Use try_serialize_absolute_path in ProcFSOverallProcesses 2022-01-12 16:09:09 +02:00
Idan Horowitz
4e7d307166 Kernel: Convert Mount::absolute_path to ErrorOr<NonnullOwnPtr<KString>> 2022-01-12 16:09:09 +02:00
Idan Horowitz
6be2a51b10 Kernel: Use Vector::try_append in Custody::try_serialize_absolute_path 2022-01-12 16:09:09 +02:00
Idan Horowitz
194d1c884b Kernel: Convert CommandLine to KString 2022-01-12 16:09:09 +02:00
Idan Horowitz
a4560313eb Kernel: Replace all usages of String::number with KString::number 2022-01-12 16:09:09 +02:00
Idan Horowitz
aa1f7060af Kernel: Add an error propagating KString::number() API
This is simply a thin wrapper around the already existing
KString::formatted() API.
2022-01-12 16:09:09 +02:00
Idan Horowitz
809870d519 Kernel: Convert ProcessorInfo to KString 2022-01-12 16:09:09 +02:00
Idan Horowitz
b4ce1e2e62 Kernel: Remove unused ProcessorInfo::m_processor field 2022-01-12 16:09:09 +02:00
Idan Horowitz
f9528f1882 Kernel: Rename ProcessorInfo::{m_brandstr => m_brand}
There's no need to specify the type of the member in it's name,
especially not in shorthand format.
2022-01-12 16:09:09 +02:00
Itamar
be81278634 HackStudio: Use ProjectBuilder to build and run the current project
This enables building and running standalone serenity components from
Hack Studio :^)
2022-01-12 14:55:19 +01:00
Itamar
bb6324a9a9 HackStudio: Add ProjectBuilder component
ProjectBuilder takes care of building and running the current project
from Hack Studio.

The existing functionality of building javascript and Makefile projects
remains, and in addition to it the ability to build standalone serenity
components is added.

If the Hack Studio project is the serenity repository itself,
ProjectBuilder will attempt building the component that the currently
active file belongs to.

It does so by creating a new CMake file which adds the component as a
build subdirectory.
It also parses all CMake files in the serenity repository to gather all
available libraries. It declares the libraries and their dependencies in
this CMake file.

It then uses the HACKSTUDIO_BUILD CMake option to direct the build
system to use this CMake file instead of doing a full system build.
2022-01-12 14:55:19 +01:00
Itamar
f464ae84ce CMake: Add HACKSTUDIO_BUILD option for building from Hack Studio
If this option is set, we will not build all components.
Instead, we include an external CMake file passed in via a variable
named HACKSTUDIO_BUILD_CMAKE_FILE.

This will be used to build serenity components from Hack Studio.
2022-01-12 14:55:19 +01:00
Itamar
afb4c447b4 HackStudio: Add optional parameters to TerminalWrapper::run()
The optional parameters allow specifying a working directory and
controlling whether or not to block until the command returns.
2022-01-12 14:55:19 +01:00
Itamar
3afd17db9d HackStudio: Add Project::project_is_serenity() function 2022-01-12 14:55:19 +01:00
Itamar
95545648bd LibCore: Add utility class for temporary files and directories
Core::TempFile is a RAII type that creates a temporary file or directory
on construction and deletes it on destruction.
2022-01-12 14:55:19 +01:00
Itamar
28a6686f2c LibC: Install libssp.a in /usr/lib
It previously was not included in the install stage.
2022-01-12 14:55:19 +01:00