Fix file reading
This commit is contained in:
@@ -77,7 +77,7 @@ u64 wapp_file_read(Array *dst_buf, File *file, u64 item_count) {
|
||||
copy_byte_count = file_length <= dst_byte_capacity ? file_length : dst_byte_capacity;
|
||||
}
|
||||
|
||||
u64 count = fread(dst_buf, sizeof(u8), copy_byte_count, file);
|
||||
u64 count = fread(dst_buf->items, sizeof(u8), copy_byte_count, file);
|
||||
if (ferror(file)) { return 0; }
|
||||
|
||||
dst_buf->count = count / item_size;
|
||||
@@ -94,7 +94,7 @@ u64 wapp_file_write(const Array *src_buf, File *file, u64 item_count) {
|
||||
u64 req_byte_count = item_count * item_size;
|
||||
u64 to_copy = req_byte_count <= src_byte_count ? req_byte_count : src_byte_count;
|
||||
|
||||
return fwrite(src_buf, sizeof(u8), to_copy, file);
|
||||
return fwrite(src_buf->items, sizeof(u8), to_copy, file);
|
||||
}
|
||||
|
||||
i32 wapp_file_flush(File *file) {
|
||||
|
||||
Reference in New Issue
Block a user