Detect a few mozilla file signatures.

Add missing option to suppress pathname sorting.
Fix chunk sizing to properly auto-enable deduplication.
Fix default dedupe block size to 8KB.
This commit is contained in:
Moinak Ghosh 2014-11-16 22:57:47 +05:30
parent 29b5efc988
commit b257c83f33
2 changed files with 23 additions and 12 deletions

View file

@ -1810,6 +1810,14 @@ detect_type_by_data(uchar_t *buf, size_t len)
// At least a few bytes.
if (len < 10) return (TYPE_UNKNOWN);
// Mozilla file types
if (len > 15) {
if (memcmp(buf, "XPCOM\nMozFASL\r\n\x1A", 16) == 0)
return (TYPE_BINARY);
if (memcmp(buf, "XPCOM\nTypeLib\r\n\032", 16) == 0)
return (TYPE_BINARY);
}
// WAV files.
if (identify_wav_type(buf, len))
return (TYPE_BINARY|TYPE_WAV);

View file

@ -3120,7 +3120,7 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
ff.enable_wavpack = 0;
pthread_mutex_lock(&opt_parse);
while ((opt = getopt(argc, argv, "dc:s:l:pt:MCDGEe:w:LPS:B:Fk:avmKjxiT")) != -1) {
while ((opt = getopt(argc, argv, "dc:s:l:pt:MCDGEe:w:LPS:B:Fk:avmKjxiTn")) != -1) {
int ovr;
int64_t chunksize;
@ -3300,6 +3300,10 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
pctx->meta_stream = -1;
break;
case 'n':
pctx->enable_archive_sort = -1;
break;
case '?':
default:
return (2);
@ -3568,6 +3572,15 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
return (1);
}
if (pctx->chunksize == 0) {
if (pctx->level < 9) {
pctx->chunksize = DEFAULT_CHUNKSIZE;
} else {
pctx->chunksize = DEFAULT_CHUNKSIZE + (pctx->level - 8) *
DEFAULT_CHUNKSIZE/4;
}
}
/*
* Auto-select filters and preprocessing modes based on compresion level.
* This is not done if user explicitly specified advanced options.
@ -3606,8 +3619,6 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
pctx->enable_rabin_split = 1;
}
pctx->rab_blk_size = 2;
if (pctx->level > 5) pctx->rab_blk_size = 1;
if (pctx->level > 8) pctx->rab_blk_size = 0;
}
if (pctx->level > 9) pctx->delta2_nstrides = NSTRIDES_EXTRA;
}
@ -3615,14 +3626,6 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
pctx->preprocess_mode = 1;
pctx->enable_analyzer = 1;
}
if (pctx->chunksize == 0) {
if (pctx->level < 9) {
pctx->chunksize = DEFAULT_CHUNKSIZE;
} else {
pctx->chunksize = DEFAULT_CHUNKSIZE + (pctx->level - 8) *
DEFAULT_CHUNKSIZE/4;
}
}
} else if (pctx->do_uncompress) {
struct filter_flags ff;
/*