Skip to content

Fix custom vsnprint formatting for width, leading zeros, and %X #33

Description

@emrainey

The custom core::vsnprint parser does not handle leading zero flags or width limits (e.g. %02X prints as ?2X on target boot logs for the Ethernet MAC address). Additionally, %X is not supported (only lowercase %x is supported which prepends 0x to all hex outputs).

This task will:

  • Enhance print_number and print_signed_number to support width, padding, uppercase hex, and signs.
  • Update core::vsnprint formatting parser to parse leading zero flags and widths prior to length modifiers.
  • Implement %X specifier (uppercase hex without prepending 0x).
  • Adjust width calculations for %x and %b to account for prepended prefixes.
  • Create unit tests under catch2-vsnprint.cpp to verify all formatting.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions