mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Add a buf1.closed field.
This commit is contained in:
1 parent
84e999c14e
commit
b3c12e05cf
9 files changed
+44
-29
No files matched your search
@@ -54,6 +54,10 @@ bool read_file(puffs_base_buf1* dst, const char* path) {
|
||||
FAIL("read_file: NULL argument");
|
||||
return false;
|
||||
}
|
||||
if (dst->closed) {
|
||||
FAIL("read_file: dst buffer closed for writes");
|
||||
return false;
|
||||
}
|
||||
FILE* f = fopen(path, "r");
|
||||
if (!f) {
|
||||
FAIL("read_file(\"%s\"): %s (errno=%d)", path, strerror(errno), errno);
|
||||
@@ -83,6 +87,7 @@ bool read_file(puffs_base_buf1* dst, const char* path) {
|
||||
return false;
|
||||
}
|
||||
fclose(f);
|
||||
dst->closed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user