From: Brion Vibber <bvibber@wikimedia.org>
To: musl@lists.openwall.com
Subject: [PATCH] Allow %lf in wprintf
Date: Wed, 11 Sep 2019 23:09:03 -0700 [thread overview]
Message-ID: <CA+30r1RSrkZyHszSGu9VFL=ZdrokazRPQfZbH3puYSdX-PaWig@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 541 bytes --]
On the emscripten mailing list we got a report that using %lf as a format
specifier for doubles worked in printf but not wprintf, which I was able to
confirm looking at the musl implementation we're using.
It looks like support for %lf in printf was added in 2012 in
commit cc3a44666, but didn't get copied to the wprintf implementation so
they're just out of sync. I've attached a small patch which copies the same
fix to the wprintf side.
Please let me know if there's any test cases I should add to, or anything
else. Thanks!
-- brion
[-- Attachment #1.2: Type: text/html, Size: 656 bytes --]
[-- Attachment #2: 0001-Fix-lf-in-wprintf.patch --]
[-- Type: application/octet-stream, Size: 974 bytes --]
From 169aeac343552c9a5f52df0f398c84370ce68c41 Mon Sep 17 00:00:00 2001
From: Brion Vibber <brion@pobox.com>
Date: Wed, 11 Sep 2019 22:43:34 -0700
Subject: [PATCH] Fix %lf in wprintf
This was fixed for printf in 2012 via cc3a44666; took
the same fix and applied it to wprintf here so they
match.
Previously, %lf caused a failure to output.
---
src/stdio/vfwprintf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index 0adf0b7a..85b036c3 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -53,6 +53,8 @@ static const unsigned char states[]['z'-'A'+1] = {
}, { /* 1: l-prefixed */
S('d') = LONG, S('i') = LONG,
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
+ S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
+ S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
S('c') = INT, S('s') = PTR, S('n') = PTR,
S('l') = LLPRE,
}, { /* 2: ll-prefixed */
--
2.20.1
next reply other threads:[~2019-09-12 6:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 6:09 Brion Vibber [this message]
2019-09-13 18:06 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+30r1RSrkZyHszSGu9VFL=ZdrokazRPQfZbH3puYSdX-PaWig@mail.gmail.com' \
--to=bvibber@wikimedia.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).