From e7566b9643aab9d1776a4db59a17ce7b3eb6b3ce Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Tue, 18 Jul 2006 16:28:58 +0000 Subject: Reindenting parse_xing, since I need to work on it and it's a mess git-svn-id: https://svn.musicpd.org/mpd/trunk@4397 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/inputPlugins/mp3_plugin.c | 83 +++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index d5ffdef8b..02c1733d9 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -423,53 +423,52 @@ enum { static int parse_xing(struct xing *xing, struct mad_bitptr ptr, unsigned int bitlen) { - unsigned long bits; + unsigned long bits; - if (bitlen < 16) goto fail; - bits = mad_bit_read(&ptr, 16); + if (bitlen < 16) goto fail; + bits = mad_bit_read(&ptr, 16); bitlen -= 16; - if (bits == XI_MAGIC) { - if (bitlen < 16) goto fail; - if (mad_bit_read(&ptr, 16) != NG_MAGIC) goto fail; - bitlen -= 16; - } - else if (bits != NG_MAGIC) goto fail; - - if (bitlen < 32) goto fail; - xing->flags = mad_bit_read(&ptr, 32); - bitlen -= 32; - - if (xing->flags & XING_FRAMES) { - if (bitlen < 32) goto fail; - xing->frames = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - if (xing->flags & XING_BYTES) { - if (bitlen < 32) goto fail; - xing->bytes = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - if (xing->flags & XING_TOC) { - int i; - if (bitlen < 800) goto fail; - for (i = 0; i < 100; ++i) xing->toc[i] = mad_bit_read(&ptr, 8); - bitlen -= 800; - } - - if (xing->flags & XING_SCALE) { - if (bitlen < 32) goto fail; - xing->scale = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - return 1; + if (bits == XI_MAGIC) { + if (bitlen < 16) goto fail; + if (mad_bit_read(&ptr, 16) != NG_MAGIC) goto fail; + bitlen -= 16; + } + else if (bits != NG_MAGIC) goto fail; + + if (bitlen < 32) goto fail; + xing->flags = mad_bit_read(&ptr, 32); + bitlen -= 32; + + if (xing->flags & XING_FRAMES) { + if (bitlen < 32) goto fail; + xing->frames = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + + if (xing->flags & XING_BYTES) { + if (bitlen < 32) goto fail; + xing->bytes = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + if (xing->flags & XING_TOC) { + int i; + if (bitlen < 800) goto fail; + for (i = 0; i < 100; ++i) xing->toc[i] = mad_bit_read(&ptr, 8); + bitlen -= 800; + } + + if (xing->flags & XING_SCALE) { + if (bitlen < 32) goto fail; + xing->scale = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + + return 1; fail: - xing->flags = 0; - return 0; + xing->flags = 0; + return 0; } static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc, -- cgit v1.2.3