hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 97e708f0a853d3fffcf0608079f21fa635333409
parent bdea37fbb8654ba2c1ecbf4ae28d0715334796a1
Author: Byron Torres <b@torresjrjr.com>
Date:   Mon, 16 May 2022 17:23:40 +0100

time::chrono: compare magic TZif bytes, not string

Signed-off-by: Byron Torres <b@torresjrjr.com>

Diffstat:
Mtime/chrono/tzdb.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/time/chrono/tzdb.ha b/time/chrono/tzdb.ha @@ -1,6 +1,7 @@ // License: MPL-2.0 // (c) 2021-2022 Byron Torres <b@torresjrjr.com> use bufio; +use bytes; use endian; use errors; use fs; @@ -76,8 +77,7 @@ fn parse_tzif(h: io::handle, tz: *timezone) (void | invalidtzif | io::error) = { // test for magic "TZif" mustread(h, buf4)?; - // TODO: Use non-aborting bytes comparison. - if (strings::fromutf8(buf4) != "TZif") { + if (!bytes::equal(buf4, ['T': u8, 'Z': u8, 'i': u8, 'f': u8])) { return invalidtzif; };