fprintf(stderr, "Input function returned error\n");
exit(1);
}
- if (bytes_read == 0 && source->padding_bytes_available > 0) {
- unsigned padding_to_add = source->padding_bytes_available;
- if (padding_to_add > bytes_to_read) {
- padding_to_add = bytes_to_read;
+ if (bytes_read == 0) {
+ source->source_eof = true;
+ if (source->padding_bytes_available > 0) {
+ unsigned padding_to_add = source->padding_bytes_available;
+ if (padding_to_add > bytes_to_read) {
+ padding_to_add = bytes_to_read;
+ }
+ memset(source->bytes + source->bytes_available, 0, padding_to_add);
+ source->padding_bytes_available -= padding_to_add;
+ source->bytes_available += padding_to_add;
+ } else {
+ fprintf(stderr, "Premature EOF\n");
+ exit(1);
}
- memset(source->bytes + source->bytes_available, 0, padding_to_add);
- source->padding_bytes_available -= padding_to_add;
- source->bytes_available += padding_to_add;
- } else if (bytes_read == 0) {
- fprintf(stderr, "Premature EOF\n");
- exit(1);
} else {
source->bytes_available += bytes_read;
}