From 1889013e900f08d5ee842a50dc13c66689ebf15b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 28 Jun 2008 18:25:07 +0200 Subject: [PATCH] Make mp3_seek_next_header() more readable. It fills in a mp3header structure. So use a function parameter instead of a global variable. --- mp3_afh.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.39.5