A few small fixes.

Effect same compression algo for Jpeg and PackJPG output.
Fix compiler warning in PackPNM.
Allow unknown type (0) to be specified for Dispack output (for analyzer).
This commit is contained in:
Moinak Ghosh 2015-01-17 20:03:06 +05:30
parent d5e1d2cdef
commit 678a6a2da4
4 changed files with 17 additions and 10 deletions

View file

@ -81,7 +81,7 @@ add_filters_by_type(struct type_data *typetab, struct filter_flags *ff)
typetab[slot].filter_private = sdat;
typetab[slot].filter_func = packjpg_filter;
typetab[slot].filter_name = "packJPG";
typetab[slot].result_type = TYPE_BINARY;
typetab[slot].result_type = -1;
slot = TYPE_BMP >> 3;
typetab[slot].filter_private = sdat;
@ -115,14 +115,14 @@ add_filters_by_type(struct type_data *typetab, struct filter_flags *ff)
if (!sdat) {
sdat = (struct scratch_buffer *)malloc(sizeof (struct scratch_buffer));
sdat->in_buff = NULL;
sdat->in_bufflen = 0;
sdat->in_bufflen = -1;
}
slot = TYPE_WAV >> 3;
typetab[slot].filter_private = sdat;
typetab[slot].filter_func = wavpack_filter;
typetab[slot].filter_name = "WavPack";
typetab[slot].result_type = 0;
typetab[slot].result_type = -1;
}
#endif
}
@ -593,7 +593,6 @@ dispack_filter(struct filter_info *fi, void *filter_private)
fi->fout->out = out;
fi->fout->out_size = len;
fi->fout->hdr_valid = 0;
*(fi->type_ptr) = TYPE_UNKNOWN;
return (ARCHIVE_OK);
}

View file

@ -1043,8 +1043,9 @@ process_by_filter(int fd, int *typ, struct archive *target_arc,
log_msg(LOG_ERR, 0, "Warning: Error invoking filter: %s (skipping)",
typetab[(*typ >> 3)].filter_name);
} else if (wrtn != FILTER_RETURN_SKIP) {
if (typetab[(*typ >> 3)].result_type != 0)
if (typetab[(*typ >> 3)].result_type > -1) {
*typ = typetab[(*typ >> 3)].result_type;
}
}
return (wrtn);
}
@ -1978,6 +1979,7 @@ detect_type_by_data(uchar_t *buf, size_t len)
return (TYPE_BINARY);
}
}
if (buf[1] == 'Z') {
// Check for MSDOS/Windows Exe types
if (buf[0] == 'L') {
@ -2002,10 +2004,11 @@ detect_type_by_data(uchar_t *buf, size_t len)
if (id == 0x010b || id == 0x020b) {
off = LE32(U32_P(buf + 0x3c))+4;
id = LE16(U16_P(buf + off));
if (id == 0x8664)
if (id == 0x8664) {
return (TYPE_BINARY|TYPE_EXE64);
else
} else {
return (TYPE_BINARY|TYPE_EXE32_PE);
}
} else {
return (TYPE_BINARY);
}

View file

@ -2288,8 +2288,13 @@ INTERN inline void rgb_process( unsigned int* rgb ) {
rgb[c] -= ( rgb[1] >> ( cmask[1]->s - cmask[c]->s ) );
rgb[c] &= cmask[c]->m;
} else {
rgb[c] -= rgb[1];
if ( rgb[c] < 0 ) rgb[c] += pnmax + 1;
int64_t rg;
rg = rgb[c];
rg -= rgb[1];
if (rg < 0)
rg += pnmax + 1;
rgb[c] = rg;
}
}
}

View file

@ -643,7 +643,7 @@ is_incompressible(int type)
int ic = 0;
int st = PC_SUBTYPE(type);
ic = (st == TYPE_JPEG) | (st == TYPE_PACKJPG) | (st == TYPE_AUDIO_COMPRESSED);
ic = (st == TYPE_PACKJPG) | (st == TYPE_AUDIO_COMPRESSED);
return (ic);
}