Added -newtimestamp and -oldtimestamp options and deprecated -time_stamp option

Default condition is -newtimestamp (output file will be timestamped with
the time it was recompressed).  If the -oldtimestamp option is used, the
output file will be given the same timestamp as the input file, which was
the default condition for recent versions of pngcrush.
This commit is contained in:
Glenn Randers-Pehrson
2009-04-19 06:20:57 -05:00
parent 98def88aa6
commit f5703de280
2 changed files with 27 additions and 10 deletions

View File

@@ -1,8 +1,17 @@
Change log:
Version 1.6.16 (built with libpng-1.2.35 and zlib-1.2.3.2)
Added -newtimestamp and -oldtimestamp options and changed
default condition to timestamping the output file with
the current time (i.e., -newtimestamp is default)
If the -oldtimestamp option is used then the output file
has the same timestamp as the input file.
Version 1.6.15 (built with libpng-1.2.35 and zlib-1.2.3.2)
Fixes some missing typecasts on png_malloc() calls, patch from
an anonymous reporter to the SourceForge bug tracker.
Added -time_stamp option to change time stamping from default
condition.
Version 1.6.14 (built with libpng-1.2.35 and zlib-1.2.3.2)
Avoids CVE-2009-0040.

View File

@@ -26,7 +26,7 @@
*
*/
#define PNGCRUSH_VERSION "1.6.15"
#define PNGCRUSH_VERSION "1.6.16"
/*
#define PNGCRUSH_COUNT_COLORS
@@ -546,7 +546,7 @@ static int best_of_three;
static int methods_specified = 0;
static int intent = -1;
static int ster_mode = -1;
static int new_time_stamp = 0;
static int new_time_stamp = 1;
static int plte_len = -1;
#ifdef PNG_FIXED_POINT_SUPPORTED
static int specified_gamma = 0;
@@ -1933,6 +1933,8 @@ int main(int argc, char *argv[])
/* no save; I just use this for testing decode speed */
nosave++;
pngcrush_mode = EXTENSION_MODE;
} else if (!strncmp(argv[i], "-oldtimestamp", 5)) {
new_time_stamp=0;
} else if (!strncmp(argv[i], "-plte_len", 9)) {
names++;
BUMP_I;
@@ -2115,8 +2117,10 @@ int main(int argc, char *argv[])
#endif
}
}
else if (!strncmp(argv[i], "-time_stamp", 5))
new_time_stamp++;
else if (!strncmp(argv[i], "-time_stamp", 5) || /* legacy */
!strncmp(argv[i], "-newtimestamp", 5))
new_time_stamp=1;
#ifdef PNG_tRNS_SUPPORTED
else if (!strncmp(argv[i], "-trns_a", 7) ||
!strncmp(argv[i], "-tRNS_a", 7)) {
@@ -5736,6 +5740,10 @@ struct options_help pngcrush_options[] = {
{2, ""},
#endif
{0, " -newtimestamp"},
{2, ""},
{2, " Reset file modification time [default]."},
{2, ""},
#ifdef PNGCRUSH_COUNT_COLORS
{0, " -no_cc (no color counting)"},
@@ -5749,12 +5757,17 @@ struct options_help pngcrush_options[] = {
{2, " ensuring that the input file is not the output file."},
{2, ""},
{0, " -oldtimestamp"},
{2, ""},
{2, " Don't reset file modification time."},
{2, ""},
{0, " -n (no save; does not do compression or write output PNG)"},
{2, ""},
{2, " Useful in conjunction with -v option to get info."},
{2, ""},
{0, " -plte_len n (truncate PLTE)"},
{2, ""},
{2, " Truncates the PLTE. Be sure not to truncate it to"},
@@ -5839,11 +5852,6 @@ struct options_help pngcrush_options[] = {
{2, " ten tEXt, iTXt, or zTXt chunks per pngcrush run."},
{2, ""},
{0, " -time_stamp"},
{2, ""},
{2, " Reset file modification time."},
{2, ""},
#ifdef PNG_tRNS_SUPPORTED
{0, " -trns_array n trns[0] trns[1] .. trns[n-1]"},
{2, ""},