diff --git a/archive/pc_archive.c b/archive/pc_archive.c index 35e8b19..029ec98 100644 --- a/archive/pc_archive.c +++ b/archive/pc_archive.c @@ -1689,7 +1689,7 @@ detect_type_by_data(uchar_t *buf, size_t len) // PNM files if (identify_pnm_type(buf, len)) { - return (TYPE_TEXT|TYPE_PNM); + return (TYPE_BINARY|TYPE_PNM); } // MSDOS COM types, two byte and one byte magic numbers are checked diff --git a/utils/phash/extensions.h b/utils/phash/extensions.h index 7275e5e..5b606e0 100644 --- a/utils/phash/extensions.h +++ b/utils/phash/extensions.h @@ -11,142 +11,146 @@ struct ext_entry { int type; int len; } extlist[] = { - {"c" , TYPE_TEXT, 1}, - {"h" , TYPE_TEXT, 1}, - {"cc" , TYPE_TEXT, 2}, - {"cpp" , TYPE_TEXT, 3}, - {"c++" , TYPE_TEXT, 3}, - {"hpp" , TYPE_TEXT, 3}, - {"txt" , TYPE_TEXT, 3}, - {"text" , TYPE_TEXT, 4}, - {"html" , TYPE_TEXT|TYPE_MARKUP, 4}, - {"htm" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"xml" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"info" , TYPE_TEXT, 4}, - {"ppm" , TYPE_TEXT, 3}, - {"svg" , TYPE_TEXT, 3}, - {"conf" , TYPE_TEXT, 4}, - {"py" , TYPE_TEXT, 2}, - {"rb" , TYPE_TEXT, 2}, - {"xpm" , TYPE_TEXT, 3}, - {"js" , TYPE_TEXT, 2}, - {"jsp" , TYPE_TEXT, 3}, - {"pl" , TYPE_TEXT, 2}, - {"tcl" , TYPE_TEXT, 3}, - {"sh" , TYPE_TEXT, 2}, - {"php" , TYPE_TEXT, 3}, - {"bat" , TYPE_TEXT, 3}, - {"pm" , TYPE_TEXT, 2}, - {"r" , TYPE_TEXT, 1}, - {"d" , TYPE_TEXT, 1}, - {"bas" , TYPE_TEXT, 3}, - {"asm" , TYPE_TEXT, 3}, - {"go" , TYPE_TEXT, 2}, - {"java" , TYPE_TEXT, 4}, - {"m4" , TYPE_TEXT, 2}, - {"vb" , TYPE_TEXT, 2}, - {"xslt" , TYPE_TEXT|TYPE_MARKUP, 4}, - {"xsl" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"yacc" , TYPE_TEXT, 4}, - {"lex" , TYPE_TEXT, 3}, - {"csv" , TYPE_TEXT, 3}, - {"shtml" , TYPE_TEXT|TYPE_MARKUP, 5}, - {"xhtml" , TYPE_TEXT|TYPE_MARKUP, 5}, - {"xht" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"asp" , TYPE_TEXT, 3}, - {"aspx" , TYPE_TEXT, 4}, - {"rss" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"atom" , TYPE_TEXT|TYPE_MARKUP, 4}, - {"cgi" , TYPE_TEXT, 3}, - {"c#" , TYPE_TEXT, 2}, - {"cob" , TYPE_TEXT, 3}, - {"ada" , TYPE_TEXT, 3}, - {"ini" , TYPE_TEXT, 3}, - {"y" , TYPE_TEXT, 1}, - {"swg" , TYPE_TEXT, 3}, - {"s" , TYPE_TEXT, 1}, - {"ps" , TYPE_TEXT, 2}, - {"bib" , TYPE_TEXT, 3}, - {"lua" , TYPE_TEXT, 3}, - {"dtd" , TYPE_TEXT, 3}, - {"qml" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"fa" , TYPE_TEXT|TYPE_DNA_SEQ, 2}, - {"faa" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, - {"asn" , TYPE_TEXT|TYPE_MARKUP, 3}, - {"ffn" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, - {"fna" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, - {"frn" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, - {"gbk" , TYPE_TEXT, 3}, - {"gff" , TYPE_TEXT, 3}, - {"ptt" , TYPE_TEXT, 3}, - {"rnt" , TYPE_TEXT, 3}, - {"val" , TYPE_BINARY, 3}, - {"tcc" , TYPE_TEXT, 3}, - {"css" , TYPE_TEXT, 3}, - {"pod" , TYPE_TEXT, 3}, - {"al" , TYPE_TEXT, 2}, - {"vim" , TYPE_TEXT, 3}, - {"am" , TYPE_TEXT, 2}, - {"upp" , TYPE_TEXT, 3}, - {"mom" , TYPE_TEXT, 3}, - {"tmac" , TYPE_TEXT, 4}, - {"pdf" , TYPE_BINARY, 3}, - {"tif" , TYPE_BINARY|TYPE_TIFF, 3}, - {"tiff" , TYPE_BINARY|TYPE_TIFF, 4}, - {"jpg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3}, - {"jpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 4}, - {"mjpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG, 5}, - {"png" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, - {"mp3" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"wma" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"divx" , TYPE_BINARY|TYPE_COMPRESSED, 4}, - {"mp4" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MP4, 3}, - {"aac" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"m4a" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"m4p" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"ofs" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"ofr" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"flac" , TYPE_BINARY|TYPE_FLAC, 4}, - {"avi" , TYPE_BINARY|TYPE_AVI, 3}, - {"pac" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"gif" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW, 3}, - {"jp2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3}, - {"pjg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_PACKJPG, 3}, - {"gz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 2}, - {"tgz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, - {"bz2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_BZ2, 3}, - {"tbz2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_BZ2, 4}, - {"zip" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ZIP, 3}, - {"arj" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ARJ, 3}, - {"arc" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ARC, 3}, - {"jar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, - {"lz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZ, 2}, - {"lzh" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"lha" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"lzma" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 4}, - {"lzo" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO, 3}, - {"dmg" , TYPE_BINARY, 3}, - {"7z" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2}, - {"uha" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"alz" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"ace" , TYPE_BINARY|TYPE_COMPRESSED, 3}, - {"rar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR, 3}, - {"xz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2}, - {"txz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 3}, - {"pmd" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_PPMD, 3}, - {"zpaq" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ZPAQ, 4}, - {"xcf" , TYPE_BINARY, 3}, - {"mo" , TYPE_BINARY, 2}, - {"pyo" , TYPE_BINARY, 3}, - {"pyc" , TYPE_BINARY, 3}, - {"wav" , TYPE_BINARY, 3}, - {"tta" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED, 3}, - {"wv" , TYPE_BINARY|TYPE_COMPRESSED, 2}, - {"swf" , TYPE_BINARY, 3}, - {"SVGZ" , TYPE_BINARY, 4}, - {"ODT" , TYPE_BINARY, 3}, - {"3DM" , TYPE_BINARY, 3}, - {"chm" , TYPE_BINARY, 3}, - {"CHM" , TYPE_BINARY, 3}, + {"c" , TYPE_TEXT, 1}, + {"h" , TYPE_TEXT, 1}, + {"cc" , TYPE_TEXT, 2}, + {"cpp" , TYPE_TEXT, 3}, + {"c++" , TYPE_TEXT, 3}, + {"hpp" , TYPE_TEXT, 3}, + {"txt" , TYPE_TEXT, 3}, + {"text" , TYPE_TEXT, 4}, + {"html" , TYPE_TEXT|TYPE_MARKUP, 4}, + {"htm" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"xml" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"info" , TYPE_TEXT, 4}, + {"svg" , TYPE_TEXT, 3}, + {"conf" , TYPE_TEXT, 4}, + {"py" , TYPE_TEXT, 2}, + {"rb" , TYPE_TEXT, 2}, + {"xpm" , TYPE_TEXT, 3}, + {"js" , TYPE_TEXT, 2}, + {"jsp" , TYPE_TEXT, 3}, + {"pl" , TYPE_TEXT, 2}, + {"tcl" , TYPE_TEXT, 3}, + {"sh" , TYPE_TEXT, 2}, + {"php" , TYPE_TEXT, 3}, + {"bat" , TYPE_TEXT, 3}, + {"pm" , TYPE_TEXT, 2}, + {"r" , TYPE_TEXT, 1}, + {"d" , TYPE_TEXT, 1}, + {"bas" , TYPE_TEXT, 3}, + {"asm" , TYPE_TEXT, 3}, + {"go" , TYPE_TEXT, 2}, + {"java" , TYPE_TEXT, 4}, + {"m4" , TYPE_TEXT, 2}, + {"vb" , TYPE_TEXT, 2}, + {"xslt" , TYPE_TEXT|TYPE_MARKUP, 4}, + {"xsl" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"yacc" , TYPE_TEXT, 4}, + {"lex" , TYPE_TEXT, 3}, + {"csv" , TYPE_TEXT, 3}, + {"shtml" , TYPE_TEXT|TYPE_MARKUP, 5}, + {"xhtml" , TYPE_TEXT|TYPE_MARKUP, 5}, + {"xht" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"asp" , TYPE_TEXT, 3}, + {"aspx" , TYPE_TEXT, 4}, + {"rss" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"atom" , TYPE_TEXT|TYPE_MARKUP, 4}, + {"cgi" , TYPE_TEXT, 3}, + {"c#" , TYPE_TEXT, 2}, + {"cob" , TYPE_TEXT, 3}, + {"ada" , TYPE_TEXT, 3}, + {"ini" , TYPE_TEXT, 3}, + {"y" , TYPE_TEXT, 1}, + {"swg" , TYPE_TEXT, 3}, + {"s" , TYPE_TEXT, 1}, + {"ps" , TYPE_TEXT, 2}, + {"bib" , TYPE_TEXT, 3}, + {"lua" , TYPE_TEXT, 3}, + {"dtd" , TYPE_TEXT, 3}, + {"qml" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"fa" , TYPE_TEXT|TYPE_DNA_SEQ, 2}, + {"faa" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, + {"asn" , TYPE_TEXT|TYPE_MARKUP, 3}, + {"ffn" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, + {"fna" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, + {"frn" , TYPE_TEXT|TYPE_DNA_SEQ, 3}, + {"gbk" , TYPE_TEXT, 3}, + {"gff" , TYPE_TEXT, 3}, + {"ptt" , TYPE_TEXT, 3}, + {"rnt" , TYPE_TEXT, 3}, + {"val" , TYPE_BINARY, 3}, + {"tcc" , TYPE_TEXT, 3}, + {"css" , TYPE_TEXT, 3}, + {"pod" , TYPE_TEXT, 3}, + {"al" , TYPE_TEXT, 2}, + {"vim" , TYPE_TEXT, 3}, + {"am" , TYPE_TEXT, 2}, + {"upp" , TYPE_TEXT, 3}, + {"mom" , TYPE_TEXT, 3}, + {"tmac" , TYPE_TEXT, 4}, + {"pdf" , TYPE_BINARY, 3}, + {"tif" , TYPE_BINARY|TYPE_TIFF, 3}, + {"tiff" , TYPE_BINARY|TYPE_TIFF, 4}, + {"jpg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3}, + {"jpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 4}, + {"mjpeg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MJPEG, 5}, + {"png" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, + {"mp3" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"wma" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"divx" , TYPE_BINARY|TYPE_COMPRESSED, 4}, + {"mp4" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_MP4, 3}, + {"aac" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"m4a" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"m4p" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"ofs" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"ofr" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"flac" , TYPE_BINARY|TYPE_FLAC, 4}, + {"avi" , TYPE_BINARY|TYPE_AVI, 3}, + {"pac" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"gif" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZW, 3}, + {"jp2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_JPEG, 3}, + {"pjg" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_PACKJPG, 3}, + {"gz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 2}, + {"tgz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, + {"bz2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_BZ2, 3}, + {"tbz2" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_BZ2, 4}, + {"zip" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ZIP, 3}, + {"arj" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ARJ, 3}, + {"arc" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ARC, 3}, + {"jar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_GZ, 3}, + {"lz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZ, 2}, + {"lzh" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"lha" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"lzma" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 4}, + {"lzo" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZO, 3}, + {"dmg" , TYPE_BINARY, 3}, + {"7z" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2}, + {"uha" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"alz" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"ace" , TYPE_BINARY|TYPE_COMPRESSED, 3}, + {"rar" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_RAR, 3}, + {"xz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 2}, + {"txz" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_LZMA, 3}, + {"pmd" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_PPMD, 3}, + {"zpaq" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_COMPRESSED_ZPAQ, 4}, + {"xcf" , TYPE_BINARY, 3}, + {"mo" , TYPE_BINARY, 2}, + {"pyo" , TYPE_BINARY, 3}, + {"pyc" , TYPE_BINARY, 3}, + {"wav" , TYPE_BINARY, 3}, + {"tta" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_AUDIO_COMPRESSED, 3}, + {"wv" , TYPE_BINARY|TYPE_COMPRESSED, 2}, + {"swf" , TYPE_BINARY, 3}, + {"SVGZ" , TYPE_BINARY, 4}, + {"ODT" , TYPE_BINARY, 3}, + {"3DM" , TYPE_BINARY, 3}, + {"chm" , TYPE_BINARY, 3}, + {"CHM" , TYPE_BINARY, 3}, + {"ppm" , TYPE_BINARY|TYPE_PNM, 3}, + {"pbm" , TYPE_BINARY|TYPE_PNM, 3}, + {"pgm" , TYPE_BINARY|TYPE_PNM, 3}, + {"pnm" , TYPE_BINARY|TYPE_PNM, 3}, + {"ppn" , TYPE_BINARY|TYPE_COMPRESSED|TYPE_PACKPNM, 3}, }; #endif diff --git a/utils/phash/extensions.txt b/utils/phash/extensions.txt index e3afa41..e4455c7 100644 --- a/utils/phash/extensions.txt +++ b/utils/phash/extensions.txt @@ -10,7 +10,6 @@ html,TYPE_TEXT|TYPE_MARKUP htm,TYPE_TEXT|TYPE_MARKUP xml,TYPE_TEXT|TYPE_MARKUP info,TYPE_TEXT -ppm,TYPE_TEXT svg,TYPE_TEXT conf,TYPE_TEXT py,TYPE_TEXT @@ -138,8 +137,8 @@ ODT,TYPE_BINARY,TYPE_COMPRESSED|TYPE_COMPRESSED_ZIP 3DM,TYPE_BINARY chm,TYPE_BINARY CHM,TYPE_BINARY -ppm,TYPE_BINARY|TYPE_COMPRESSED|TYPE_PNM -pbm,TYPE_BINARY|TYPE_COMPRESSED|TYPE_PNM -pgm,TYPE_BINARY|TYPE_COMPRESSED|TYPE_PNM -pnm,TYPE_BINARY|TYPE_COMPRESSED|TYPE_PNM +ppm,TYPE_BINARY|TYPE_PNM +pbm,TYPE_BINARY|TYPE_PNM +pgm,TYPE_BINARY|TYPE_PNM +pnm,TYPE_BINARY|TYPE_PNM ppn,TYPE_BINARY|TYPE_COMPRESSED|TYPE_PACKPNM diff --git a/utils/phash/phash.c b/utils/phash/phash.c index 3e3b889..edb9b68 100644 --- a/utils/phash/phash.c +++ b/utils/phash/phash.c @@ -12,14 +12,14 @@ /* small adjustments to _a_ to make values distinct */ ub1 tab[] = { -125,0,0,220,125,0,82,82,113,0,0,113,0,0,113,125, -0,0,7,32,0,113,82,0,0,183,0,131,0,7,220,120, -0,0,0,0,85,0,0,0,0,113,125,113,0,7,22,0, -82,0,7,113,125,125,0,0,0,113,113,85,220,0,0,85, -0,82,0,0,113,0,85,183,82,88,11,85,55,113,0,0, -124,0,113,125,0,125,0,235,0,82,125,55,0,22,0,92, -0,125,113,7,0,40,0,0,82,61,0,42,0,11,177,15, -0,0,0,0,0,6,0,0,56,11,0,0,164,47,0,0, +125,0,0,220,85,0,82,87,113,0,0,113,0,0,82,125, +0,0,7,87,0,113,82,0,0,183,0,131,0,7,0,253, +0,0,0,0,85,0,113,0,0,113,125,113,0,7,22,0, +82,0,7,113,125,125,0,0,0,113,113,131,220,0,0,85, +0,87,0,0,113,0,85,183,82,88,7,88,58,113,0,0, +124,0,168,125,0,125,0,116,0,82,125,55,0,22,116,12, +0,125,113,113,0,40,0,0,42,232,0,124,0,92,183,61, +0,0,221,0,0,234,0,0,97,11,0,0,164,91,0,0, }; /* The hash function */ diff --git a/utils/phash/phash.h b/utils/phash/phash.h index 11a1ffc..aa7445c 100644 --- a/utils/phash/phash.h +++ b/utils/phash/phash.h @@ -8,7 +8,7 @@ extern ub1 tab[]; #define PHASHLEN 0x80 /* length of hash mapping table */ -#define PHASHNKEYS 137 /* How many keys were hashed */ +#define PHASHNKEYS 141 /* How many keys were hashed */ #define PHASHRANGE 256 /* Range any input might map to */ #define PHASHSALT 0x9e3779b9 /* internal, initialize normal hash */