Skip to content

Commit

Permalink
music_mad.c: SDL_RWread() returns size_t, i.e. an unsigned value:
Browse files Browse the repository at this point in the history
as such, read_size cannot be negative. adjusted read_next_frame()
accordingly.

[ FIXME: how to detect error instead of eof? ]
  • Loading branch information
slouken committed Oct 16, 2017
1 parent c76447d commit 038ffa5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions music_mad.c
Expand Up @@ -109,13 +109,10 @@ read_next_frame(mad_data *mp3_mad) {
/* Now read additional bytes from the input file. */
read_size = SDL_RWread(mp3_mad->src, read_start, 1, read_size);

if (read_size <= 0) {
if (read_size == 0) {
if ((mp3_mad->status & (MS_input_eof | MS_input_error)) == 0) {
if (read_size == 0) {
mp3_mad->status |= MS_input_eof;
} else {
mp3_mad->status |= MS_input_error;
}
/* FIXME: how to detect error? */
mp3_mad->status |= MS_input_eof;

/* At the end of the file, we must stuff MAD_BUFFER_GUARD
number of 0 bytes. */
Expand Down

0 comments on commit 038ffa5

Please sign in to comment.