From 9c1838e38617700364b63d3c2ed99bc54461d4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 10:59:29 +0100 Subject: Use memmem to search for the Annodex string, rather than reimplementing it by hand. --- src/combined/xine_ogg_demuxer.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index edf98eb0a..159f4b662 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1959,32 +1959,14 @@ static int detect_anx_content (int detection_method, demux_class_t *class_gen, case METHOD_BY_CONTENT: { uint8_t buf[ANNODEX_SIGNATURE_SEARCH]; - int found_annodex_signature = 0; - static const char annodex_signature[] = "Annodex"; - static const int annodex_signature_length = 7; /* = strlen(annodex_signature) */ - int i, j; if (_x_demux_read_header(input, buf, ANNODEX_SIGNATURE_SEARCH) != ANNODEX_SIGNATURE_SEARCH) return 0; /* scan for 'Annodex' signature in the first 64 bytes */ - for (i = 0, j = 0; i < ANNODEX_SIGNATURE_SEARCH; i++) { - if (buf[i] == annodex_signature[j]) { - if (j >= annodex_signature_length) { - /* found signature */ - found_annodex_signature = 1; - break; - } else { - j++; - } - } - } - - if (found_annodex_signature) - return 1; - else - return 0; + return !!memmem(buf, ANNODEX_SIGNATURE_SEARCH, + "Annodex", sizeof("Annodex")-1); } #undef ANNODEX_SIGNATURE_SEARCH -- cgit v1.2.3