diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-19 10:59:29 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-19 10:59:29 +0100 |
commit | 9c1838e38617700364b63d3c2ed99bc54461d4e3 (patch) | |
tree | 100e5f02f4f2308d4b07e2d75079f9479a3c5e1e | |
parent | 09fedf23246bd7b622a362c57e34143cb7af32bd (diff) | |
download | xine-lib-9c1838e38617700364b63d3c2ed99bc54461d4e3.tar.gz xine-lib-9c1838e38617700364b63d3c2ed99bc54461d4e3.tar.bz2 |
Use memmem to search for the Annodex string, rather than reimplementing it by hand.
-rw-r--r-- | src/combined/xine_ogg_demuxer.c | 22 |
1 files 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 |