Commit graph

45125 commits

Author SHA1 Message Date
Ben Wiederhake
c2a900b853 Everywhere: Remove unused includes of AK/StdLibExtras.h
These instances were detected by searching for files that include
AK/StdLibExtras.h, but don't match the regex:

\\b(abs|AK_REPLACED_STD_NAMESPACE|array_size|ceil_div|clamp|exchange|for
ward|is_constant_evaluated|is_power_of_two|max|min|mix|move|_RawPtr|RawP
tr|round_up_to_power_of_two|swap|to_underlying)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any "extra stdlib" functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
0bde4e66fa Piano: Remove unused include of AK/StdLibExtraDetails.h
This instance was detected by searching for files that include
AK/StdLibExtraDetails.h, but don't match the regex:

\\b(AddConst|__AddConstToReferencedType|AddConstToReferencedType|AddLval
ueReference|__AddReference|AddRvalueReference|__AssertSize|AssertSize|__
CommonType|CommonType|__Conditional|Conditional|CopyConst|__Decay|Decay|
declval|DependentFalse|FalseType|__IdentityType|IdentityType|IndexSequen
ce|IntegerSequence|IntegralConstant|IsArithmetic|IsAssignable|IsBaseOf|I
sCallableWithArguments|IsClass|IsConst|IsConstructible|IsConvertible|IsC
opyAssignable|IsCopyConstructible|IsDestructible|IsEnum|__IsFloatingPoin
t|IsFloatingPoint|IsFunction|IsFundamental|IsHashCompatible|__IsIntegral
|IsIntegral|IsLvalueReference|IsMoveAssignable|IsMoveConstructible|IsNul
lPointer|IsOneOf|IsOneOfIgnoringCV|IsPOD|IsPointer|__IsPointerHelper|IsP
ointerOfType|IsRvalueReference|IsSame|IsSameIgnoringCV|IsSigned|IsSpecia
lizationOf|IsTrivial|IsTriviallyAssignable|IsTriviallyConstructible|IsTr
iviallyCopyable|IsTriviallyCopyAssignable|IsTriviallyCopyConstructible|I
sTriviallyDestructible|IsTriviallyMoveAssignable|IsTriviallyMoveConstruc
tible|IsUnion|IsUnsigned|IsVoid|MakeIndexSequence|MakeIntegerSequence|ma
ke_integer_sequence_impl|__MakeSigned|MakeSigned|__MakeUnsigned|MakeUnsi
gned|__RemoveConst|RemoveConst|RemoveCV|RemoveCVReference|__RemovePointe
r|RemovePointer|__RemoveReference|RemoveReference|__RemoveVolatile|Remov
eVolatile|TrueType|UnderlyingType|Void|VoidType)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any "detailed extra stdlib" functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
6fd478b6ce Everywhere: Remove unused includes of AK/Format.h
These instances were detected by searching for files that include
AK/Format.h, but don't match the regex:

\\b(CheckedFormatString|critical_dmesgln|dbgln|dbgln_if|dmesgln|FormatBu
ilder|__FormatIfSupported|FormatIfSupported|FormatParser|FormatString|Fo
rmattable|Formatter|__format_value|HasFormatter|max_format_arguments|out
|outln|set_debug_enabled|StandardFormatter|TypeErasedFormatParams|TypeEr
asedParameter|VariadicFormatParams|v_critical_dmesgln|vdbgln|vdmesgln|vf
ormat|vout|warn|warnln|warnln_if)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any formatting functions.

Observe that this revealed that Userland/Libraries/LibC/signal.cpp is
missing an include.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
345662d617 Userland: Remove unused includes of AK/Math.h
These instances were detected by searching for files that include
Kernel/Debug.h, but don't match the regex:

\\b(acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|cos|cosh|E|exp|exp2
|fabs|fmod|hypot|log|log10|log2|NaN|Pi|pow|product_even|product_odd|rema
inder|round_to|rsqrt|sin|sincos|sinh|sqrt|Sqrt1_2|Sqrt2|tan|tanh)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any math functions.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake
8a331d4fa0 Everywhere: Move AK/Debug.h include to using files or remove 2023-01-02 20:27:20 -05:00
Ben Wiederhake
a55360781b LibGL: Move AK/Debug.h include to where it is used 2023-01-02 20:27:20 -05:00
Ben Wiederhake
143a64f9a2 Kernel: Remove unused includes of Kernel/Debug.h
These instances were detected by searching for files that include
Kernel/Debug.h, but don't match the regex:
\\bdbgln_if\(|_DEBUG\\b
This regex is pessimistic, so there might be more files that don't check
for any real *_DEBUG macro. There seem to be no corner cases anyway.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
kleines Filmröllchen
a6a439243f Kernel: Turn lock ranks into template parameters
This step would ideally not have been necessary (increases amount of
refactoring and templates necessary, which in turn increases build
times), but it gives us a couple of nice properties:
- SpinlockProtected inside Singleton (a very common combination) can now
  obtain any lock rank just via the template parameter. It was not
  previously possible to do this with SingletonInstanceCreator magic.
- SpinlockProtected's lock rank is now mandatory; this is the majority
  of cases and allows us to see where we're still missing proper ranks.
- The type already informs us what lock rank a lock has, which aids code
  readability and (possibly, if gdb cooperates) lock mismatch debugging.
- The rank of a lock can no longer be dynamic, which is not something we
  wanted in the first place (or made use of). Locks randomly changing
  their rank sounds like a disaster waiting to happen.
- In some places, we might be able to statically check that locks are
  taken in the right order (with the right lock rank checking
  implementation) as rank information is fully statically known.

This refactoring even more exposes the fact that Mutex has no lock rank
capabilites, which is not fixed here.
2023-01-02 18:15:27 -05:00
Ben Wiederhake
363cc12146 Revert "LibJS: Implement MakeDay without using AK::years_to_days_since…"
This reverts commit 032664332b.

Now that AK::years_to_days_since_epoch has acceptable performance, we
can go back to the "easy" way of computing the unix epoch time.
2023-01-02 16:19:35 -05:00
Ben Wiederhake
3334cf675a AK+Kernel: Eliminate UB (signed overflow) from days_since_epoch 2023-01-02 16:19:35 -05:00
Ben Wiederhake
7a69219a35 AK+Tests: Replace years_to_days_since_epoch by near-instant function
This solves half the problem of #12729. Note that the inverse function
time_to_tm() in LibC/time.cpp still uses a slow for-loop.

See also #13138
2023-01-02 16:19:35 -05:00
Ben Wiederhake
60ee695287 AK+Tests: Demonstrate slowness of years_to_days_since_epoch
In practice, this function does not take any perceptible amount of time.
However, this benchmark demonstrates that for extreme values, the
internal for-loop does matter.
2023-01-02 16:19:35 -05:00
Lenny Maiorani
e0ab7763da AK: Combine SinglyLinkedList and SinglyLinkedListWithCount
Using policy based design `SinglyLinkedList` and
`SinglyLinkedListWithCount` can be combined into one class which takes
a policy to determine how to keep track of the size of the list. The
default policy is to use list iteration to count the items in the list
each time. The `WithCount` form is a different policy which tracks the
size, but comes with the overhead of storing the count and
incrementing/decrementing on each modification.

This model is extensible to have other forms of counting by
implementing only a new policy instead of implementing a totally new
type.
2023-01-02 20:13:24 +00:00
Arda Cinar
0105600120 AK+Tests: Add a test for formatting numbers in base 10 units
Added a test case to TestNumberFormat to test the new base 10 formatting
capability
2023-01-02 20:11:18 +00:00
Arda Cinar
0dbb1be81c AK: Add an option to format numbers with 1000 based units
Instead of only allowing 1024-based units.
2023-01-02 20:11:18 +00:00
Arda Cinar
ccb6b4f943 AK: Make sure no overflow occurs in number_string_with_one_decimal
A possible integer overflow might have occured inside the function in
case (number % unit) * 10 did not fit into a u64. So it is verified that
this does not happen at the beginning of the function.
2023-01-02 20:11:18 +00:00
Arda Cinar
76fce0b899 df: Add an option to display used/available inodes 2023-01-02 20:11:18 +00:00
Arda Cinar
c8fadff9b1 AK: Add a human_readable_quantity helper to NumberFormat.h
This can be used for displaying large quantities that are not measured
in bytes in a more human-readable format.
2023-01-02 20:11:18 +00:00
Arda Cinar
3e924e2a37 AK: Move the functions in NumberFormat.h out of line 2023-01-02 20:11:18 +00:00
Arda Cinar
ef71104620 df: Show used percentages for each listed entry 2023-01-02 20:11:18 +00:00
Ben Wiederhake
b2cd935efd LibCore: Remove unused include MemMem
These instances were detected by searching for files that include
MemMem.h, but don't match the regex:
\\b(MemMem(?!\.h>)|bitap_bitwise|memmem|memmem_optional)\\b
These are the only symbols defined by MemMem.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00
Ben Wiederhake
c1676cdddb Everywhere: Remove unused includes of AK/IterationDecision.h
These instances were detected by searching for files that include
IterationDecision.h, but don't match the regex:
\\bIterationDecision(?!\.h>)\\b
This is the only symbol defined by IterationDecision.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00
Ben Wiederhake
a8391d5a60 Everywhere: Remove unused includes of AK/Array.h
These instances were detected by searching for files that include
Array.h, but don't match the regex:
\\b(Array(?!\.h>)|iota_array|integer_sequence_generate_array)\\b
These are the three symbols defined by Array.h.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:08:35 +00:00
Ben Wiederhake
add6be4c64 Kernel: Remove unused includes 2023-01-02 11:06:15 -05:00
Ben Wiederhake
b83cb09db1 Everywhere: Fix badly-formatted includes
In 7c5e30daaa, the focus was "only" on
Userland/Libraries/, whereas this commit cleans up the remaining
headers in the repo, and any new badly-formatted include.
2023-01-02 11:06:15 -05:00
ericLemanissier
9d61e59ceb LibHTTP: Propagate errors using TRY 2023-01-02 11:04:38 -05:00
ericLemanissier
55405105a8 LibEDID: Propagate errors using TRY 2023-01-02 11:04:38 -05:00
ericLemanissier
2065bc5e98 LibCrypto: Propagate errors using TRY 2023-01-02 11:04:38 -05:00
Brandon Jordan
4321a7def1 Base+Userland: Add menu item icons
Base+Userland: Add menu item icons

This adds missing icons to Presenter Presentation menu.

This adds missing icon to Image Viewer View menu.

This adds a scale icon for the Image Viewer and Font Editor.

This moves the Fit Image to View icon to the 16x16 folder as it's now
used by Image Viewer and not only Pixel Paint.

This improves the fullscreen and play icons so that they fit together
better.
2023-01-02 09:56:05 -05:00
Evan Smal
50c0d0a3b0 Solitaire: Add link to help page 2023-01-02 09:50:37 -05:00
Andreas Kling
88ebc44cbf Demos: Remove "Mouse" application
This was a plain-looking test app for debugging mouse events.
Mouse events work now, and if we want mouse testing facilities, they
can be added to MouseSettings instead.
2023-01-02 15:29:12 +01:00
Andreas Kling
6760653d62 Demos: Remove "Fire" application
This served no purpose other than looking somewhat neat.
2023-01-02 15:29:12 +01:00
Nico Weber
79badfd650 LibGfx+icc: Print pcs illuminant 2023-01-02 15:20:51 +01:00
kleines Filmröllchen
3df2eb66be Base: Move GML Widget documentation to subsubsection
This is not only convenient, but also a subsection testcase :^)
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
ad6cbc4192 Base: Move GML documentation into subsection
That was the whole point of this endeavour :^)
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
f824a67b3b Base: Document manpage structure separately
This section is now removed from Help(1) and man(1).
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
2d08e53493 Help: Detect clicked page correctly
index_from_path is the only remaining model index handling function that
wasn't aware of subsections. After this change, clicked pages are
resolved to a model index correctly, eliminating the weird
subsection-expansion bugs from before.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
3cecd612ba Help: Don't expand the whole tree of the selected node's parent
This now expands nodes unnecessarily with nested sections.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
201c9d7c77 Help+LibManual: Open sibling page for subsections
Clicking on a subsection now displays the sibling page, which is
intended to be the main page for that section.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
3e67f14e58 LibManual: Create subsections for subdirectories automatically 2023-01-02 06:15:13 -07:00
kleines Filmröllchen
a9fe80550d LibManual: Add SubsectionNode 2023-01-02 06:15:13 -07:00
kleines Filmröllchen
2aa374eba1 Help+LibManual: Move URL handling to LibManual 2023-01-02 06:15:13 -07:00
kleines Filmröllchen
a676cf658b Utilities: Resolve manpage paths more robustly in markdown-check
The path is now relative to the Serenity source directory, and later
parts of the URL path are not simply discarded. This allows links into
subsection man pages to be checked correctly.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
44e4a38535 LibManual: Allow overriding a Node's path calculation
This is necessary for subclassing SectionNode, but generally allows more
code to rely on path() virtual dispatch always finding the correct path
regardless of the static type.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
aa5e574872 Help+LibManual: Make the children accessor fallible
This is convenient for the section node which might compute children
on the fly.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
437d3ca0ea Help: Use array size instead of sizeof to determine number of sections
This was a relict when the sections were still a help-internal array.
2023-01-02 06:15:13 -07:00
kleines Filmröllchen
1ec0548158 Help: Only toggle open/close for SectionNodes
The responsible code was actually casting everything to a SectionNode
pointer, violating type safety all over the place and leading to
frequent crashes. I'm surprised this was not exhibited before; I guess
my recent changes made this bug surface.
2023-01-02 06:15:13 -07:00
Liav A
cf3b75e2e6 Kernel: Propagate properly errors from PCI IDE Controller initialization 2023-01-02 04:59:23 -07:00
Liav A
735aa01b58 Kernel: Remove stale detect_disks method from PCI IDE controller class 2023-01-02 04:59:23 -07:00
kleines Filmröllchen
b8e4e473e8 Base: Add 8 new emoji and improve consistency on one more
- 👐 U+1F450 Open Hands
- 🙌 U+1F64C Raising Hands is modified to match 👐 and other hand emoji.
-  U+270A Raised Fist
- ✴️ U+2734 Eight-Pointed Star
- ❇️ U+2747 Sparkle
-  U+274E Cross Mark Button
- ❤️‍🔥 U+2764 U+200D U+1F525 Heart on Fire
- 〰️ U+3030 Wavy Dash
2023-01-01 18:42:29 -05:00