diff options
author | Max Kellermann <max@duempel.org> | 2012-09-04 11:22:05 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-09-04 11:22:05 +0200 |
commit | 0d24250aa702eb94289890466aba9fd959df2e22 (patch) | |
tree | 156dfea6aaac3cc6c64feb5e5289c1b94a1d2901 /src/decoder | |
parent | 2050e2f886b772102fe99c29a1ac24867ffbcdbf (diff) | |
download | mpd-0d24250aa702eb94289890466aba9fd959df2e22.tar.gz mpd-0d24250aa702eb94289890466aba9fd959df2e22.tar.xz mpd-0d24250aa702eb94289890466aba9fd959df2e22.zip |
decoder/_ogg_common: simplify the large "if" expression
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/_ogg_common.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/decoder/_ogg_common.c b/src/decoder/_ogg_common.c index bedd3de61..8df97eef8 100644 --- a/src/decoder/_ogg_common.c +++ b/src/decoder/_ogg_common.c @@ -33,12 +33,14 @@ ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream) size_t r; r = decoder_read(NULL, inStream, buf, sizeof(buf)); - if (r >= 32 && memcmp(buf, "OggS", 4) == 0 && ( - (memcmp(buf+29, "FLAC", 4) == 0 - && memcmp(buf+37, "fLaC", 4) == 0) - || (memcmp(buf+28, "FLAC", 4) == 0) - || (memcmp(buf+28, "fLaC", 4) == 0))) { + if (r < 32 || memcmp(buf, "OggS", 4) != 0) + return VORBIS; + + if ((memcmp(buf + 29, "FLAC", 4) == 0 && + memcmp(buf + 37, "fLaC", 4) == 0) || + memcmp(buf + 28, "FLAC", 4) == 0 || + memcmp(buf + 28, "fLaC", 4) == 0) return FLAC; - } + return VORBIS; } |