gcc 15 and C23 force some union trickery on buffer.h :-(

add a few buffer_init*_forread variants to pretend we have type safety
  make sure buffer_init_staticcontents handles flushing attempts
This commit is contained in:
leitner
2025-04-22 09:32:03 +00:00
parent 9bf6db9a02
commit b7b8a0efc1
37 changed files with 325 additions and 64 deletions

View File

@@ -1,7 +1,10 @@
#include <libowfat/buffer.h>
#include <libowfat/mmap.h>
static ssize_t op() {
static ssize_t op(int fd,void* buf,size_t l) {
(void)fd;
(void)buf;
(void)l;
return 0;
}
@@ -9,7 +12,7 @@ int buffer_mmapread(buffer* b,const char* filename) {
if (!(b->x=(char*)mmap_read(filename,&b->n))) return -1;
b->p=0; b->a=b->n;
b->fd=-1;
b->op=op;
b->op.rop=op;
b->deinit=buffer_munmap;
return 0;
}