Commit Graph

81 Commits

Author SHA1 Message Date
75ba14a3ad
Add UTF-8 decoder support!! 2022-12-18 13:04:40 +01:00
ee6387e7b5
Refactor NumberParsing.cpp + a lot of comments 2022-12-17 15:00:19 +01:00
97cb57d521
Check for overflow/underflow in parse_signed_integer
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 14:42:56 +01:00
16954695dd
Tell the compiler that string_format is a printf-style function
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 12:45:26 +01:00
abbed13f27
Add a 'pure' variant of cstyle_format which is infallible
If we cannot fail to output, it doesn't make sense to propagate errors. So if you're SURE there are no errors, use pure_cstyle_format().
If, however, output can fail, use cstyle_format().

This has a drawback of adding quite a bit of code duplication to Format.cpp.
Some of it is dealt using templates, but some code still remains duplicate.
2022-12-17 12:38:22 +01:00
48fcb8734a
Give number parsing functions more meaningful names 2022-12-17 12:12:58 +01:00
cf3b2176f0
Implement OwnedStringView::from_string_literal
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 11:36:16 +01:00
da39ba33a9
Move OwnedStringView::operator[] out of line 2022-12-16 20:48:58 +01:00
59765aa334
Rename String.h -> CString.h
All checks were successful
continuous-integration/drone/push Build is passing
Let's not confuse String.h with a managed string class, it's in fact the equivalent of the C stdlib's <string.h>
2022-12-16 20:40:04 +01:00
42a2c2af49
Add strdup() 2022-12-16 20:37:57 +01:00
e56075fb46
Use nothrow in raw_malloc 2022-12-16 20:36:43 +01:00
4a6c59d519
Make all methods in OwnedStringView const
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-16 19:48:22 +01:00
814672c771
Remove some redundant error propagation
All checks were successful
continuous-integration/drone/push Build is passing
Why can printing to the serial port or format onto a string fail?
Even if cstyle_format returns Result<usize>, we shouldn't always follow suit.
2022-12-16 18:32:29 +01:00
41b3c8adb2
Convert to_dynamic_unit to OwnedStringView and rename the old variant to to_dynamic_unit_cstr
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-16 18:18:24 +01:00
be22cf6267
Introduce OwnedStringView
A managed String which uses RAII to free its contents. It's not a proper string though, since it's read-only.
So it's a StringView... but an owned one.

Can't be copied automatically, must be either moved or copied manually by calling clone() on it.
2022-12-16 18:17:15 +01:00
b9f3d3c349
Remove ENONE
All checks were successful
continuous-integration/drone/pr Build is passing
If you want to return an error without meaning, use Option.
2022-12-08 16:09:33 +01:00
6de7753b4c
Add malloc wrappers
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-07 18:17:49 +01:00
8da5521273 Add a Stack convenience class 2022-12-07 16:11:59 +00:00
f65ed465c4 Bitmap: Fix crash by attempting to memset -1 bits (UINT64_MAX) 2022-12-07 16:11:59 +00:00
d3458f2f0f Bitmap: short circuit on 0-byte clears 2022-12-07 16:11:59 +00:00
287c4ab060 Run clang-format 2022-12-07 16:11:59 +00:00
986aa01948
size_t -> usize
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-07 17:06:29 +01:00
beab3454b5
kernel: Enable -Wsign-conversion and -Wcast-align
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-07 11:47:46 +01:00
1badc40a4a
Run include-what-you-use everywhere 2022-12-07 11:40:02 +01:00
8598b1e8fc
Replace the _noreturn macro with the C++ native attribute [[noreturn]]
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-06 19:40:35 +01:00
eef74e2897
Add a generic error code (ENONE) 2022-12-06 17:35:38 +01:00
792642dd6f
MORE CONST 2022-12-05 12:58:59 +01:00
86a12f301e
Make value_byte a helper 2022-12-05 12:53:16 +01:00
004e13a5f3
Make bitmap methods const if not modifying the bitmap 2022-12-05 12:50:30 +01:00
5aa2d1fa18
Add a Bitmap class to provide common functionality and use that in the MemoryManager 2022-12-04 15:14:07 +01:00
c7ab6bc2d3
Reorganize the luna/ directory so that headers aren't in the top level include path 2022-12-04 12:42:43 +01:00