From 0d24250aa702eb94289890466aba9fd959df2e22 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 4 Sep 2012 11:22:05 +0200 Subject: decoder/_ogg_common: simplify the large "if" expression --- src/decoder/_ogg_common.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/decoder') 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; } -- cgit v1.2.3