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;
}
/* clear it, because not all paths to here do */
state->eosin = 0;
- while (!state->eosin) { /* We reached eos, not eof */
+ do {
/* We copy the rest of the stream (other logical streams)
* through, a page at a time.
*/
bytes = fread (buffer, 1, CHUNKSIZE, state->in);
ogg_sync_wrote (&state->oy, bytes);
- if (!bytes)
- state->eosin = 1;
- }
+ state->eosin = !bytes && feof (state->in);
+ } while (!state->eosin);
fclose (out);
fclose (state->in);