summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/scanf.cpp
diff options
context:
space:
mode:
authorJesse Buhagiar <jooster669@gmail.com>2022-01-01 21:11:02 +1100
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-02 08:10:08 +0200
commit2de7f2021d1f4881ab1b19b63002e3c978634399 (patch)
tree05aa7c54c652a7da0a738bb76afc101c965f1ef0 /Userland/Libraries/LibC/scanf.cpp
parent022b4a3ed38655e6c89d71b8b45936871d2d76d2 (diff)
downloadserenity-2de7f2021d1f4881ab1b19b63002e3c978634399.zip
LibC: Support `X` modifier for `scanf`
This was currently crashing Half-Life because it was a considered an "Unknown" specifier. We can use the same case statement as the regular hex format conversion (lower case 'x'), as the backend to convert the number already supports upper/lower case input, hence we get it for free :^)
Diffstat (limited to 'Userland/Libraries/LibC/scanf.cpp')
-rw-r--r--Userland/Libraries/LibC/scanf.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/scanf.cpp b/Userland/Libraries/LibC/scanf.cpp
index d66043aa10..f760922de3 100644
--- a/Userland/Libraries/LibC/scanf.cpp
+++ b/Userland/Libraries/LibC/scanf.cpp
@@ -488,6 +488,7 @@ extern "C" int vsscanf(const char* input, const char* format, va_list ap)
conversion_specifier = ConversionSpecifier::Unsigned;
break;
case 'x':
+ case 'X':
format_lexer.consume();
conversion_specifier = ConversionSpecifier::Hex;
break;