1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-25 02:47:40 +00:00

sag:: fixed some warnings

This commit is contained in:
Zeno Rogue
2024-07-24 19:29:12 +02:00
parent 0a3653f7fd
commit 04098490d3
4 changed files with 6 additions and 6 deletions

View File

@@ -79,7 +79,7 @@ struct sagdist_t {
clear();
fd = open(fname.c_str(), O_RDONLY | O_LARGEFILE);
if(fd == -1) throw hr_exception("open failed in map");
read(fd, &N, 8);
if(read(fd, &N, 8) < 8) throw hr_exception("file error");
tabmap = (distance*) mmap(nullptr, N*N*sizeof(distance)+8, PROT_READ, MAP_SHARED, fd, 0);
@@ -117,7 +117,7 @@ struct sagdist_t {
void save(string fname) {
fd = open(fname.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
write(fd, &N, 8);
if(write(fd, &N, 8) < 8) throw hr_exception("write error");
size_t size = N*N*sizeof(distance);
println(hlog, "size is ", hr::format("%zd", size));
char *p = (char*) tab;