aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/decoder/_ogg_common.c14
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;
}