authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-09-17 09:27:24+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-09-17 09:27:24+02:00
logb7f9f779afa6de38f7599d8ffd9937fb48b9284c
tree17a214975df95ed2651426f942769ee97410d486
parent27adb82fda516e95c3c03df80a95b895969fdd56

translate-c: Fix formatting of non-printable chars

The two octets in hex notation must be aligned to the right and padded on the left, not the other way around.

1 files changed, 1 insertions(+), 1 deletions(-)

src-self-hosted/translate_c.zig+1-1
......@@ -2032,7 +2032,7 @@ fn escapeChar(c: u8, char_buf: *[4]u8) []const u8 {
20322032 // Handle the remaining escapes Zig doesn't support by turning them
20332033 // into their respective hex representation
20342034 else => if (std.ascii.isCntrl(c))
2035 std.fmt.bufPrint(char_buf, "\\x{x:0<2}", .{c}) catch unreachable
2035 std.fmt.bufPrint(char_buf, "\\x{x:0>2}", .{c}) catch unreachable
20362036 else
20372037 std.fmt.bufPrint(char_buf, "{c}", .{c}) catch unreachable,
20382038 };