[Extractor-gtk-cvslog] SF.net SVN: extractor-gtk: [37] trunk/extractor/generic.c
Extract files from unusual archive formats
Brought to you by:
someone-guy
From: <som...@us...> - 2007-09-16 11:01:10
|
Revision: 37 http://extractor-gtk.svn.sourceforge.net/extractor-gtk/?rev=37&view=rev Author: someone-guy Date: 2007-09-16 04:01:08 -0700 (Sun, 16 Sep 2007) Log Message: ----------- Make it easy to change format of detection ringbuffer Modified Paths: -------------- trunk/extractor/generic.c Modified: trunk/extractor/generic.c =================================================================== --- trunk/extractor/generic.c 2007-09-16 11:01:01 UTC (rev 36) +++ trunk/extractor/generic.c 2007-09-16 11:01:08 UTC (rev 37) @@ -26,8 +26,10 @@ *list = l; } +typedef uint32_t buffer_t; + static file_t *get_list(FILE *in) { - register uint32_t t = 0; + register buffer_t t = 0; int i; int bz2idx = -1; int cnt = 0; @@ -35,7 +37,7 @@ rewind(in); while (!feof(in) && cnt + 3 < SIZE_MAX / sizeof(file_t)) { t = t << 8 | fgetc(in); - switch (t) { + switch (t & 0xffffffff) { case TAG('R', 'I', 'F', 'F'): add_entry(&list, cnt, "riff"); list[cnt].start = ftell(in) - 4; @@ -80,8 +82,8 @@ if (bz2idx >= 0) { // bzip2 block end marker, between 25 and 32 bits of it are used // change these and t to 64 bit for more accurate detection - uint32_t endmark = 0x177245385090ULL; - uint32_t mask = 0xffffffffffffULL; + buffer_t endmark = 0x177245385090ULL; + buffer_t mask = 0xffffffffffffULL; for (i = 0; i < 8; i++) { if ((t & mask) == endmark) { // end marker plus space for CRC This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |