Commit graph

47238 commits

Author SHA1 Message Date
Humberto Alves f6eb155167 Kernel: Support more clocks in sys$clock_getres()
Support all the available clocks in clock_getres(). Also, fix this
function to use the actual ticks per second value, not the constant
`_SC_CLK_TCK` (which is always equal to 8) and move the resolution
computation logic to TimeManagement.
2023-02-21 01:00:06 +01:00
Andreas Kling 3c7a0ef1ac AK: Disallow constness laundering in RefPtr and NonnullRefPtr
Until now, it was possible to assign a RP<T const> or NNRP<T const>
to RP<T> or NNRP<T>. This meant that the constness of the T was lost.

We had a lot of code that relied on this sloppiness, and by the time
you see this commit, I hopefully found and fixed all of it. :^)
2023-02-21 00:54:04 +01:00
Andreas Kling 33e87d1627 Userland: Fix remaining smart pointer const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling faa1a09042 LibGUI: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling bfe081caad LibGfx: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 38b6eedd54 WebContent: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 025bdcf34c WindowServer: Fix various const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling dbcf2f2dd4 LibManual: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling f11899f885 LibWeb+LibIDL: Fix (or paper over) various const-correctness issues
There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
2023-02-21 00:54:04 +01:00
Andreas Kling 68b5df6bf1 Shell: Fix (and paper over) various const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 39a1702c99 LibPDF: Make Object::cast<T>() non-const
This was only ever used to cast non-const objects to other non-const
object types.
2023-02-21 00:54:04 +01:00
Andreas Kling 87e26d2fa4 Assistant: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 70d7fb6a03 LibCpp: Make C++ AST (mostly) const-correct
I cheated and used const_cast to avoid dealing with the strange pattern
where we sometimes do a delayed reparenting of an AST node.
2023-02-21 00:54:04 +01:00
Andreas Kling eb4a69c377 LibImageDecoderClient: Fix minor const-correctness issue
By taking ownership of the bitmaps after decoding them, we avoid having
to call an API that would give us a const Bitmap.
2023-02-21 00:54:04 +01:00
Andreas Kling 456f12c5c8 LibPartition: Make Kernel parts const-correct re: StorageDevice&
We can't do I/O with a const StorageDevice&, so it has to be non-const.
2023-02-21 00:54:04 +01:00
Andreas Kling c837e7bbf3 LibGL: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling ca44b26b2a LibGfx: Make Gfx::Path const-correct internally (segment list) 2023-02-21 00:54:04 +01:00
Andreas Kling 485958bb6f LibTest: Fix minor const-correctness issue in TestSuite::find_cases() 2023-02-21 00:54:04 +01:00
Andreas Kling 08a90455ac LibCards: Make find_card_stack_to_drop_on() non-const
This function returns a card stack that we might want to drop a card on,
so intuitively it should be a mutating function.
2023-02-21 00:54:04 +01:00
Andreas Kling df07416171 PixelPaint: Store tool cursors as NNRP<Gfx::Bitmap const> 2023-02-21 00:54:04 +01:00
Andreas Kling 65710bf3f7 LibSQL: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 0cdd227e9b Kernel: Fix const-correctness issue in StorageManagement
We have to take the StorageDevice as a mutable reference, otherwise
we can't perform any interesting I/O operations on it.
2023-02-21 00:54:04 +01:00
Andreas Kling b5cef78e35 Kernel: Make NVMeQueue const-correct internally
Store the DMA R/W page PhysicalPage object as an NNRP<T const>.
2023-02-21 00:54:04 +01:00
Andreas Kling 68c9781299 Kernel: Fix const-correctness of PCI::DeviceIdentifier usage 2023-02-21 00:54:04 +01:00
Andreas Kling 053afbf2d1 PixelPaint: Make Filter::apply() non-virtual and non-const
It didn't need to be either of these things.
2023-02-21 00:54:04 +01:00
Andreas Kling 2530b301db LibGfx: Add const hack in Bitmap::to_bitmap_backed_by_anonymous_buffer() 2023-02-21 00:54:04 +01:00
Andreas Kling 8bf248a046 Kernel: Make NNRP<PhysicalPage const> possible
This wasn't possible before as ref() and unref() were non-const.
2023-02-21 00:54:04 +01:00
Andreas Kling e08c55dd8d AK: Make String const-correct internally 2023-02-21 00:54:04 +01:00
Andreas Kling a56dfd5c77 AK: Make Deprecated{Fly,}String and StringImpl const-correct 2023-02-21 00:54:04 +01:00
Andreas Kling 4b3e229157 LibGfx: Replace Bitmap::invert() with Bitmap::inverted()
The new function return a new bitmap instead of mutating the current
one in place.
2023-02-21 00:54:04 +01:00
Andreas Kling 1f907a834f LibGfx: Make Bitmap::scaled(1) return a clone
While returning the same image is a cute optimization, it violates the
expectation that the returned Bitmap is a new bitmap, not shared with
anyone else.
2023-02-21 00:54:04 +01:00
Andreas Kling bd5d8e9d35 LibJS: Make RefPtr and NonnullRefPtr usage const-correct
This mainly affected the AST, which is now const throughout.
2023-02-21 00:54:04 +01:00
Andreas Kling b2b942b4ec AK: Stop NonnullPtrVector from making accessed elements const 2023-02-21 00:54:04 +01:00
Niklas Poslovski 13f6767637 LibSQL: Don't use fchmod for socket on any BSD 2023-02-20 18:47:09 +01:00
nipos f700d553ab LibCore: Add support for NetBSD in anon_create 2023-02-20 18:46:51 +01:00
nipos 9a77934e23 LibCore: Enable file descriptor passing on all BSDs 2023-02-20 18:46:36 +01:00
nipos 5b147f29ab AK/StackInfo: Add support for NetBSD 2023-02-20 18:44:36 +01:00
nipos b3aa36d7bd LibCore: All BSDs need sig_t instead of sighandler_t 2023-02-20 18:42:54 +01:00
nipos d710da108c LibCore: Implement socket credentials for NetBSD 2023-02-20 18:42:29 +01:00
Sam Atkins e54a03d497 LibGUI: Use Gfx::Font::bold_variant() instead of a manual lookup
This has the nice side-effect of being cached in the Font, instead of
being repeatedly looked up in the FontDatabase.
2023-02-20 18:41:47 +01:00
Sam Atkins efd56cda6a LibGUI: Use a while loop for iterating text spans 2023-02-20 18:41:47 +01:00
Sam Atkins 04deb81f71 LibGUI: Validate TextDocument spans when merging them, not when painting
TextDocument::merge_span_collections() automatically makes sure that the
spans are valid, move forwards, are in order, and do not overlap. This
means we don't have to check these things every time TextEditor paints
the document.

merge_span_collections() now does these checks instead. I am not certain
they are still useful, but someone in the past certainly did. I have
modified them to take advantage of the operator overloads and Formatter
that we now have.
2023-02-20 18:41:47 +01:00
Sam Atkins 54d45d4ac6 LibGUI: Add and use TextEditor::fixed_elements_width()
We were manually adding together the gutter and ruler widths in several
places. Soon we'll have a third section that needs to be included in
this width, so let's abstract it now.
2023-02-20 18:41:47 +01:00
Sam Atkins 1a5159df73 LibGUI+HackStudio: Simplify TextEditor gutter & ruler calculations
- Make gutter/ruler_content_rect() return rectangles relative to the
  TextEditor widget.
- Re-order painting code to translate the Painter after the gutter/ruler
  has been painted, to use those coordinates.
- Consistently put gutter before ruler in code, because that's the order
  they physically appear.
2023-02-20 18:41:47 +01:00
MacDue 3676f5085e LibWeb: Replace RefPtr with ValueComparingRefPtr in StyleValue
Like the name suggests this pointer type compares its pointees by value
rather than just by the pointer. This is needed for the defaulted
struct Properties equality operator.

This commit also contains a few changes to StyleValue such as replacing
the operator==()s with a .equals() again. This is done to avoid the new
reversed operator==()s ambiguity in C++20.
2023-02-20 10:50:20 +01:00
Nico Weber 1d124af66f LibGfx: Implement serialization of Lut16TagData and Lut8TagData 2023-02-19 23:46:36 +01:00
Nico Weber 4bafdaba3f LibGfx: Make Lut16TagData and Lut8TagData ctors verify table sizes
The from_bytes() methods error out on invalid table sizes,
but let's make sure other potential future callers get it right too.
2023-02-19 23:46:36 +01:00
Nico Weber 51be964884 LibGfx: Fix 7-bit ASCII checks in textDescriptionType and textType
This used to check the empty, moved-from parameter instead of
the member variable (-‸ლ)
2023-02-19 23:46:36 +01:00
Nico Weber 8f181e0e94 LibGfx: Implement serialization of NamedColor2TagData 2023-02-19 23:46:36 +01:00
Nico Weber eac9941766 LibGfx: Make NamedColor2TagData verify inputs are 32-byte 7-bit ASCII
NamedColor2TagData::from_bytes() errors out if that isn't the case,
but let's make sure other potential future callers get it right too.
2023-02-19 23:46:36 +01:00