By default, only highlight the base name of the file to-be-saved. When
the file includes an extension, it's useful to be able to just start
typing a file name without having to manually de-select the extension
(or having to rewrite the extension).
This wasn't doing anything interesting enough to justify being its own
demo application. If we need a spinning cube, we can just load a cube
model into 3DFileViewer. :^)
Instead of opening and reparsing WindowServer.ini at random occasions,
just keep the file open after loading it in serenity_main().
This avoids a bunch of unnecessary work, and also fixes an issue where
WindowManager::m_config might re-write stale values to disk.
We now propagate errors when using the {Layer,Image}::flip(),
{Layer,Image}::crop(), {Layer,Image}::rotate() and
{Layer,Image}::resize() functions.
We handle these errors by show an error DialogBox with the error's
message.
This removes 8 FIXMEs:))
These instances were detected by searching for files that include
AK/Memory.h, but don't match the regex:
\\b(fast_u32_copy|fast_u32_fill|secure_zero|timing_safe_compare)\\b
This regex is pessimistic, so there might be more files that don't
actually use any memory function.
In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
These instances were detected by searching for files that include
stdlib.h, but don't match the regex:
\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b
(Without the linebreaks.)
This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.
In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
These instances were detected by searching for files that include
AK/Concepts.h, but don't match the regex:
\\b(AnyString|Arithmetic|ArrayLike|DerivedFrom|Enum|FallibleFunction|Flo
atingPoint|Fundamental|HashCompatible|Indexable|Integral|IterableContain
er|IteratorFunction|IteratorPairWith|OneOf|OneOfIgnoringCV|SameAs|Signed
|SpecializationOf|Unsigned|VoidFunction)\\b
(Without the linebreaks.)
This regex is pessimistic, so there might be more files that don't
actually use any concepts.
In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.