mirror of https://github.com/fairyglade/ly.git
Fix big clock UB in ReleaseSafe
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
063b3145ed
commit
36a27f6167
|
@ -34,24 +34,24 @@ pub fn alphaBlit(x: usize, y: usize, tb_width: usize, tb_height: usize, cells: [
|
|||
}
|
||||
}
|
||||
|
||||
fn toBigNumber(char: u8, bigclock: Bigclock) []const u21 {
|
||||
fn toBigNumber(char: u8, bigclock: Bigclock) [SIZE]u21 {
|
||||
const locale_chars = switch (bigclock) {
|
||||
.fa => fa.locale_chars,
|
||||
.en => en.locale_chars,
|
||||
.none => unreachable,
|
||||
};
|
||||
return switch (char) {
|
||||
'0' => &locale_chars.ZERO,
|
||||
'1' => &locale_chars.ONE,
|
||||
'2' => &locale_chars.TWO,
|
||||
'3' => &locale_chars.THREE,
|
||||
'4' => &locale_chars.FOUR,
|
||||
'5' => &locale_chars.FIVE,
|
||||
'6' => &locale_chars.SIX,
|
||||
'7' => &locale_chars.SEVEN,
|
||||
'8' => &locale_chars.EIGHT,
|
||||
'9' => &locale_chars.NINE,
|
||||
':' => &locale_chars.S,
|
||||
else => &locale_chars.E,
|
||||
'0' => locale_chars.ZERO,
|
||||
'1' => locale_chars.ONE,
|
||||
'2' => locale_chars.TWO,
|
||||
'3' => locale_chars.THREE,
|
||||
'4' => locale_chars.FOUR,
|
||||
'5' => locale_chars.FIVE,
|
||||
'6' => locale_chars.SIX,
|
||||
'7' => locale_chars.SEVEN,
|
||||
'8' => locale_chars.EIGHT,
|
||||
'9' => locale_chars.NINE,
|
||||
':' => locale_chars.S,
|
||||
else => locale_chars.E,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ pub const SIZE = WIDTH * HEIGHT;
|
|||
pub const X: u32 = if (builtin.os.tag == .linux or builtin.os.tag.isBSD()) 0x2593 else '#';
|
||||
pub const O: u32 = 0;
|
||||
|
||||
// zig fmt: off
|
||||
pub const LocaleChars = struct {
|
||||
ZERO: [SIZE]u21,
|
||||
ONE: [SIZE]u21,
|
||||
|
@ -21,3 +22,4 @@ pub const LocaleChars = struct {
|
|||
S: [SIZE]u21,
|
||||
E: [SIZE]u21,
|
||||
};
|
||||
// zig fmt: on
|
||||
|
|
Loading…
Reference in New Issue