[flashrom] Radix for layout ranges

David Hendricks dhendrix at google.com
Mon Nov 22 23:09:37 CET 2010


Hi,
I just noticed (read: hit an issue) that ranges specified in layout files
are always assumed to be hex. From layout.c:
rom_entries[romimages].start = strtol(tstr1, (char **)NULL, 16);
 rom_entries[romimages].end = strtol(tstr2, (char **)NULL, 16);

Is there a specific reason base 16 is used? Should we just leave it at "0"
and let strtol decide, depending on the prefix (0x for hex, dec otherwise)?

The reason I bring this up is because I am working with testing scripts that
generate ranges on the fly. It's an extra step to convert values to hex
(printf %x $value?) and I want to reduce dependency on external programs /
maximize portability.

If this sounds reasonable, the patch attached simply changes the radix used
by strtol to "0" do dec is chosen if there is no prefix and hex is chosen if
the number is prefixed with 0x.
Signed-off-by: David Hendricks <dhedndrix at google.com>

-- 
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20101122/1d7cb0bf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use_default_base_in_layout.diff
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20101122/1d7cb0bf/attachment.diff>


More information about the flashrom mailing list