mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +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
+3
-6
@@ -22,8 +22,7 @@ void test_constructor_not_called() {
|
||||
puffs_gif_lzw_decoder dec;
|
||||
puffs_base_buf1 dst = {0};
|
||||
puffs_base_buf1 src = {0};
|
||||
puffs_gif_status status =
|
||||
puffs_gif_lzw_decoder_decode(&dec, &dst, &src, false);
|
||||
puffs_gif_status status = puffs_gif_lzw_decoder_decode(&dec, &dst, &src);
|
||||
if (status != puffs_gif_error_constructor_not_called) {
|
||||
FAIL("status: got %d, want %d", status,
|
||||
puffs_gif_error_constructor_not_called);
|
||||
@@ -34,8 +33,7 @@ void test_bad_argument_null() {
|
||||
test_funcname = __func__;
|
||||
puffs_gif_lzw_decoder dec;
|
||||
puffs_gif_lzw_decoder_constructor(&dec, PUFFS_VERSION, 0);
|
||||
puffs_gif_status status =
|
||||
puffs_gif_lzw_decoder_decode(&dec, NULL, NULL, false);
|
||||
puffs_gif_status status = puffs_gif_lzw_decoder_decode(&dec, NULL, NULL);
|
||||
if (status != puffs_gif_error_bad_argument) {
|
||||
FAIL("status: got %d, want %d", status, puffs_gif_error_bad_argument);
|
||||
}
|
||||
@@ -72,8 +70,7 @@ void test_bad_receiver() {
|
||||
test_funcname = __func__;
|
||||
puffs_base_buf1 dst = {0};
|
||||
puffs_base_buf1 src = {0};
|
||||
puffs_gif_status status =
|
||||
puffs_gif_lzw_decoder_decode(NULL, &dst, &src, false);
|
||||
puffs_gif_status status = puffs_gif_lzw_decoder_decode(NULL, &dst, &src);
|
||||
if (status != puffs_gif_error_bad_receiver) {
|
||||
FAIL("status: got %d, want %d", status, puffs_gif_error_bad_receiver);
|
||||
}
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ void test_lzw_decode() {
|
||||
puffs_gif_lzw_decoder dec;
|
||||
puffs_gif_lzw_decoder_constructor(&dec, PUFFS_VERSION, 0);
|
||||
puffs_gif_lzw_decoder_set_literal_width(&dec, literal_width);
|
||||
puffs_gif_status status =
|
||||
puffs_gif_lzw_decoder_decode(&dec, &got, &src, false);
|
||||
puffs_gif_status status = puffs_gif_lzw_decoder_decode(&dec, &got, &src);
|
||||
if (status != puffs_gif_status_ok) {
|
||||
FAIL("status: got %d, want %d", status, puffs_gif_status_ok);
|
||||
goto cleanup1;
|
||||
|
||||
@@ -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