History

test/libmpv_encode: check fread return value

Fixes warning with clang

llyyr committed 2 years ago

Commit f89d0d41 parent 6c59b021 file · +3 −3Browse files

Showing the changes to test (1 of 1 file). Show all

Unified · Split

test/libmpv_encode.c+3−3
@@ -94,11 +94,11 @@ static void check_output(FILE *fp) · 93 unmodified lines
9494 if (size < 100)
9595 fail("did not encode anything\n");
9696
97− char magic[4] = {0};
97+ char magic[4];
9898 fseek(fp, 0, SEEK_SET);
99− fread(magic, sizeof(magic), 1, fp);
99+ size_t ret = fread(magic, sizeof(magic), 1, fp);
100100 static const char ebml_magic[] = {26, 69, 223, 163};
101− if (memcmp(magic, ebml_magic, 4) != 0)
101+ if (ret != 1 || memcmp(magic, ebml_magic, sizeof(magic)) != 0)
102102 fail("output was not Matroska\n");
103103
104104 puts("output file ok");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t