bytes = fread (buffer, 1, CHUNKSIZE, s->in);
ogg_sync_wrote (&s->oy, bytes);
- if (!bytes)
+ if (!bytes && feof (s->in))
return 0;
}
buffer = ogg_sync_buffer (&state->oy, CHUNKSIZE);
bytes = fread (buffer, 1, CHUNKSIZE, state->in);
- if (!bytes && i < 2) {
+ if (!bytes && feof (state->in) && i < 2) {
ret = VCEDIT_ERR_INVAL;
goto err;
}
bytes = fread (buffer, 1, CHUNKSIZE, state->in);
ogg_sync_wrote (&state->oy, bytes);
- if (!bytes)
- state->eosin = 1;
+ state->eosin = !bytes && feof (state->in);
}
fclose (out);