changeset 20400:f4518826ea84

Allow lowercase letters in AVI stream id, fixes bug #277
author reimar
date Mon, 23 Oct 2006 16:46:16 +0000
parents 27aa9329d4f7
children c96e99bef4dd
files libmpdemux/demux_avi.c
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Mon Oct 23 15:49:44 2006 +0000
+++ b/libmpdemux/demux_avi.c	Mon Oct 23 16:46:16 2006 +0000
@@ -80,14 +80,11 @@
 }
 
 static int valid_fourcc(unsigned int id){
+    static const char valid[] = "0123456789abcdefghijklmnopqrstuvwxyz"
+                                "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
     unsigned char* fcc=(unsigned char*)(&id);
-#define FCC_CHR_CHECK(x) (x<48 || x>=96)
-    if(FCC_CHR_CHECK(fcc[0])) return 0;
-    if(FCC_CHR_CHECK(fcc[1])) return 0;
-    if(FCC_CHR_CHECK(fcc[2])) return 0;
-    if(FCC_CHR_CHECK(fcc[3])) return 0;
-    return 1;
-#undef FCC_CHR_CHECK
+    return strchr(valid, fcc[0]) && strchr(valid, fcc[1]) &&
+           strchr(valid, fcc[2]) && strchr(valid, fcc[3]);
 }
 
 static int choose_chunk_len(unsigned int len1,unsigned int len2){