From: "Sebastian Herbszt" <herbszt@gmx.de>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: seabios@seabios.org, QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [SeaBIOS] SMBIOS strings
Date: Wed, 2 Jun 2010 23:01:17 +0200 [thread overview]
Message-ID: <D8841A6889B54BCEAB997DD5155CB04A@FSCPC> (raw)
In-Reply-To: <4C05FDDA.7040107@redhat.com>
Jes Sorensen wrote:
> On 06/01/10 22:26, Sebastian Herbszt wrote:
>> Jes Sorensen wrote:
>>> Handle 0x0401, DMI type 4, 32 bytes
>>> Processor Information
>>> - Socket Designation: CPU 1
>>> + Socket Designation: CPU01
>>
>> smbios.c got
>> snprintf((char*)start, 6, "CPU%2x", cpu_number);
>>
>> It should print "CPU 1" instead of "CPU01" because the
>> padding should be done with spaces not zeros. Maybe
>> bvprintf() doesn't handle it correctly?
>
> I looked at the man page for snprintf() and it isn't clear to me that it
> is required to space pad when printing hex numbers.
"The flag characters
...
0
The value should be zero padded. For d, i, o, u, x, X, a, A, e, E, f, F, g,
and G conversions, the converted value is padded on the left with zeros rather
than blanks. If the 0 and - flags both appear, the 0 flag is ignored. If a
precision is given with a numeric conversion (d, i, o, u, x, and X), the 0 flag
is ignored. For other conversions, the behavior is undefined." [1]
So without "0" flag it should be space padded.
> Having looked at the other pieces, I think this is probably the only one
> we might want to change. It should be pretty easy to just do something like:
>
> if (cpu_number < 0x10)
> snprintf("CPU %x", cpu_number);
> else
> snprintf("CPU%2x", cpu_number);
>
> Esthetically I think this would be prettier, but question is whether
> it's something to worry about or not.
Either change it here or fix bvprintf().
Also "CPU a" looks a bit weird. Maybe change it to "CPU A" (upper case letter) ?
> Cheers,
> Jes
[1] http://linux.die.net/man/3/printf
Sebastian
prev parent reply other threads:[~2010-06-02 21:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-28 15:24 [Qemu-devel] SMBIOS strings Jes Sorensen
2010-05-28 15:44 ` [Qemu-devel] Re: [SeaBIOS] " Gleb Natapov
2010-05-31 7:32 ` Jes Sorensen
2010-05-31 7:50 ` Gleb Natapov
2010-05-31 20:38 ` Sebastian Herbszt
2010-06-01 5:34 ` Markus Armbruster
2010-06-01 6:05 ` Jes Sorensen
2010-06-01 23:57 ` [SeaBIOS] [Qemu-devel] " Kevin O'Connor
2010-06-01 13:02 ` Olivier Galibert
2010-06-01 5:36 ` [Qemu-devel] Re: [SeaBIOS] " Gleb Natapov
2010-05-29 12:49 ` Sebastian Herbszt
2010-05-31 7:33 ` Jes Sorensen
2010-05-29 16:15 ` Kevin O'Connor
2010-06-01 20:26 ` Sebastian Herbszt
2010-06-01 23:34 ` Kevin O'Connor
2010-06-02 20:35 ` Sebastian Herbszt
2010-06-02 6:44 ` Jes Sorensen
2010-06-02 21:01 ` Sebastian Herbszt [this message]
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=D8841A6889B54BCEAB997DD5155CB04A@FSCPC \
--to=herbszt@gmx.de \
--cc=Jes.Sorensen@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
/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.
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).