From: Andre Noll Date: Sat, 28 Jun 2008 16:25:07 +0000 (+0200) Subject: Make mp3_seek_next_header() more readable. X-Git-Tag: v0.3.3~53^2~12 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=1889013e900f08d5ee842a50dc13c66689ebf15b;p=paraslash.git Make mp3_seek_next_header() more readable. It fills in a mp3header structure. So use a function parameter instead of a global variable. --- diff --git a/mp3_afh.c b/mp3_afh.c index 225ddd60..8b8a83d8 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -231,7 +231,8 @@ out: * Return the length of the next frame header or zero if the end of the file is * reached. */ -static int mp3_seek_next_header(unsigned char *map, size_t numbytes, off_t *fpos) +static int mp3_seek_next_header(unsigned char *map, size_t numbytes, off_t *fpos, + struct mp3header *result) { int k, l = 0, first_len; struct mp3header h, h2; @@ -254,7 +255,7 @@ static int mp3_seek_next_header(unsigned char *map, size_t numbytes, off_t *fpos } if (k == MIN_CONSEC_GOOD_FRAMES) { *fpos = valid_start; - mp3.header = h2; + *result = h2; return first_len; } } @@ -309,7 +310,7 @@ static int find_valid_start(unsigned char *map, size_t numbytes, off_t *fpos) if (frame_len < 0) return frame_len; if (!frame_len) { - frame_len = mp3_seek_next_header(map, numbytes, fpos); + frame_len = mp3_seek_next_header(map, numbytes, fpos, &mp3.header); if (frame_len <= 0) return frame_len; } else