Age | Commit message (Collapse) | Author |
|
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp,
memcpy and other related declarations.
In the quest to remove inclusion of LibC headers from Kernel files, deal
with all the fallout of this included-everywhere header including less
things.
|
|
|
|
|
|
Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
|
|
|
|
It seems that Filip has already done the hard work, and found out the
implementation different between unix* and windows.
Borrowed from:
https://github.com/SerenityOS/serenity/compare/master...filiphsps:serenity:dev-win32#diff-e3209c9a434a102d0d9459e31e33ddb729dff925b95f41b9d1e56c1e7f88c487R466
Co-authored-by: Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
|
|
|
|
|
Both calls essentially only differ in one boolean, which dictates
whether to print the value in uppercase or lowercase.
Move the long function call into a new function and pass in the
"uppercase" boolean seperately to avoid having to write everything
twice.
|
|
Those functions only differ by the input type of `number`. No other
wrapper does this, as they rely on adjusting the type of the argument on
the caller side instead.
Avoid specializing too much by just doing the same for signed numbers.
|
|
|
|
|
|
This keeps us from stopping early and not rendering the argument at all.
|
|
|
|
|
|
|
|
|
|
Previously if code attempted to use the format specifier somewhere
(Ex: "%#4.3Lg"), the specifier would get dropped and we would just
print "g" instead of any value. Now at least we print a value.
|
|
printf didn't check whether the additional integer variable belongs to
the field width specifier or to the precision specifier, and always
applied it to the field width instead.
Implement the case distinction that we already use in literal width
and precision specifiers for the variable version as well so that
they are correctly attributed.
|
|
Problem:
- Static variables take memory and can be subject to less optimization.
- This static variable is only used in 1 place.
Solution:
- Move the variable into the function and make it non-static.
|
|
This adds support for '%.20s' and friends :^)
|
|
SPDX License Identifiers are a more compact / standardized
way of representing file license information.
See: https://spdx.dev/resources/use/#identifiers
This was done with the `ambr` search and replace tool.
ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
|
|
We were using u32 as a pointer representation and not FlatPtr
|
|
|
|
This API was a mostly gratuitous deviation from POSIX that gave up some
portability in exchange for avoiding the occasional strlen().
I don't think that was actually achieving anything valuable, so let's
just chill out and have the same open() API as everyone else. :^)
|
|
This was a non-standard specifier alias for %04x. This patch replaces
all uses of it with new-style formatting functions instead.
|
|
This was a non-standard specifier alias for %02x. This patch replaces
all uses of it with new-style formatting functions instead.
|
|
We have to include the plus sign in the number of characters written,
otherwise sprintf() will put the null terminator too early.
|
|
|
|
|
|
The following is now possible:
outf("{:.4}", "abcdef"); // abcd
outf("{:*<8}", "abcdef"); // abcdef**
|
|
I put this into the <AK/PrintfImplementation.h> header in the hope that
it could be re-used by the printf implementation. That would not be
super trivial though, so I am not doing that now.
|
|
|
|
This also fixes an issue with the color input value being messed up.
oops :P
|
|
This makes PrintfImplementation usable with any sequence, provided that
a 'next element' function can be written for it.
Does not affect the behaviour of printf() and co.
|
|
|
|
Fixes #2776.
This fixes, among other things, JSON serialization.
The underlying bug was that 'print_double' defined fraction_length
as a function argument with a default value, whereas
printf_internal *always* provided a value, even if nothing was read.
The 'use 6 by default' logic has been moved to printf_internal instead.
|
|
It was me who has broken this, sorry ;(
|
|
This was supposed to be the foundation for some kind of pre-kernel
environment, but nobody is working on it right now, so let's move
everything back into the kernel and remove all the confusion.
|
|
|
|
zeroPad => zero_pad
leftPad => left_pad
fieldWidth => field_width
These were the only variables with names in camelCase.
We were not consistent with the naming of these variables: some times we
called them zeroPad, leftPad, fieldWidth; other times we called them
zero_pad, left_pad, field_width.
These inconsistencies made the code hard to read, so I changed their
names to snake_case.
Also rename width => field_width in AK::print_hex()
|
|
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
|
|
This patch adds the missing part for the printf of double values to specify
the length of the fraction part. For GVariant, a default of %.2 is used.
|
|
This patchset allows double numbers to be printed with the printf function.
The fraction will always be printed as 6 digit number. This can be improved :^)
|
|
Instead of simply outputting the character. This way, we get proper padding
support and other niceties strings enjoy.
|
|
I introduced this while implementing "%.*s", oops.
|
|
Work towards #623.
|
|
|
|
|
|
|