mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
shada: Fix -Wstrict-aliasing gcc error
Also removes theoretically possible unaligned memory access when computing be64toh() argument.
This commit is contained in:
parent
bcb60b0a64
commit
9afa45e639
@ -3294,14 +3294,14 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader,
|
||||
return kSDReadStatusNotShaDa;
|
||||
}
|
||||
}
|
||||
uint8_t buf[sizeof(uint64_t)] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint64_t buf = 0;
|
||||
char *buf_u8 = (char *) &buf;
|
||||
ShaDaReadResult fl_ret;
|
||||
if ((fl_ret = fread_len(sd_reader, (char *) &(buf[sizeof(uint64_t)-length]),
|
||||
length))
|
||||
if ((fl_ret = fread_len(sd_reader, &(buf_u8[sizeof(buf)-length]), length))
|
||||
!= kSDReadStatusSuccess) {
|
||||
return fl_ret;
|
||||
}
|
||||
*result = be64toh(*((uint64_t *) &(buf[0])));
|
||||
*result = be64toh(buf);
|
||||
}
|
||||
return kSDReadStatusSuccess;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user