Skip to content

Commit

Permalink
Remove extra line in warnings in ivfdec.c
Browse files Browse the repository at this point in the history
The warnings give an extra line which is confusing sometimes.

E.g.

Warning: Read invalid frame size (308164564) // This is for frame 5

Warning: Failed to decode frame 5: Invalid parameter
Warning: Read invalid frame size (1936229463) // This is for frame 6

Warning: Failed to decode frame 6: Invalid parameter
Warning: Read invalid frame size (2282536257)

Change-Id: I1753fa32079deca5c8b534c6ca9a527cc9e491e9
  • Loading branch information
jeromejj committed May 10, 2018
1 parent 5f3e991 commit 401c896
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ivfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ int ivf_read_frame(FILE *infile, uint8_t **buffer, size_t *bytes_read,
size_t frame_size = 0;

if (fread(raw_header, IVF_FRAME_HDR_SZ, 1, infile) != 1) {
if (!feof(infile)) warn("Failed to read frame size\n");
if (!feof(infile)) warn("Failed to read frame size");
} else {
frame_size = mem_get_le32(raw_header);

if (frame_size > 256 * 1024 * 1024) {
warn("Read invalid frame size (%u)\n", (unsigned int)frame_size);
warn("Read invalid frame size (%u)", (unsigned int)frame_size);
frame_size = 0;
}

Expand All @@ -92,15 +92,15 @@ int ivf_read_frame(FILE *infile, uint8_t **buffer, size_t *bytes_read,
*buffer = new_buffer;
*buffer_size = 2 * frame_size;
} else {
warn("Failed to allocate compressed data buffer\n");
warn("Failed to allocate compressed data buffer");
frame_size = 0;
}
}
}

if (!feof(infile)) {
if (fread(*buffer, 1, frame_size, infile) != frame_size) {
warn("Failed to read full frame\n");
warn("Failed to read full frame");
return 1;
}

Expand Down

0 comments on commit 401c896

Please sign in to comment.