summaryrefslogtreecommitdiff
path: root/AK/PrintfImplementation.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-05 10:50:19 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-05 11:04:10 +0100
commite9403e2b032f97a72ebdfedc09b4dce2eb8b3f81 (patch)
tree57fa371ce98f962d7d48b3896bcf9fe66056d346 /AK/PrintfImplementation.h
parenteed78ffa5ab1200df90b9bdb0369501a8f471138 (diff)
downloadserenity-e9403e2b032f97a72ebdfedc09b4dce2eb8b3f81.zip
AK: printf was not accounting for plus sign with "%+d"
We have to include the plus sign in the number of characters written, otherwise sprintf() will put the null terminator too early.
Diffstat (limited to 'AK/PrintfImplementation.h')
-rw-r--r--AK/PrintfImplementation.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h
index d3d1545e62..0b202a2b79 100644
--- a/AK/PrintfImplementation.h
+++ b/AK/PrintfImplementation.h
@@ -284,7 +284,7 @@ ALWAYS_INLINE int print_signed_number(PutChFunc putch, char*& bufptr, int number
}
if (always_sign)
putch(bufptr, '+');
- return print_number(putch, bufptr, number, left_pad, zero_pad, field_width);
+ return print_number(putch, bufptr, number, left_pad, zero_pad, field_width) + always_sign;
}
struct ModifierState {