Imported from pngcrush-1.6.13.tar

This commit is contained in:
Glenn Randers-Pehrson
2009-01-07 13:45:55 -06:00
parent 7e14fc86dc
commit 0fb6c554f9
2 changed files with 22 additions and 5 deletions

View File

@@ -1,5 +1,10 @@
Change log:
Version 1.6.13 (built with libpng-1.2.34 and zlib-1.2.3.2)
Added "-time_stamp" directive, to cause pngcrush to write
a new timestamp on the output file instead of replicating
the timestame from the input file.
Version 1.6.12 (built with libpng-1.2.34 and zlib-1.2.3.2)
Version 1.6.11 (built with libpng-1.2.33 and zlib-1.2.3.2)

View File

@@ -26,7 +26,7 @@
*
*/
#define PNGCRUSH_VERSION "1.6.12"
#define PNGCRUSH_VERSION "1.6.13"
/*
#define PNGCRUSH_COUNT_COLORS
@@ -88,8 +88,6 @@
*
* Finish pplt (partial palette) feature.
*
* add "-time" directive
*
* Allow in-place file replacement or as a filter, as in
* "pngcrush -overwrite file.png"
* "pngcreator | pngcrush > output.png"
@@ -548,6 +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 plte_len = -1;
#ifdef PNG_FIXED_POINT_SUPPORTED
static int specified_gamma = 0;
@@ -2116,6 +2115,8 @@ int main(int argc, char *argv[])
#endif
}
}
else if (!strncmp(argv[i], "-time_stamp", 5))
new_time_stamp++;
#ifdef PNG_tRNS_SUPPORTED
else if (!strncmp(argv[i], "-trns_a", 7) ||
!strncmp(argv[i], "-tRNS_a", 7)) {
@@ -4545,7 +4546,7 @@ int main(int argc, char *argv[])
setfiletype(outname);
}
if (verbose > 0 && nosave == 0) {
if (nosave == 0) {
png_uint_32 input_length, output_length;
#ifndef __riscos
struct stat stat_buf;
@@ -4557,11 +4558,15 @@ int main(int argc, char *argv[])
utim.modtime = stat_buf.st_mtime;
stat(outname, &stat_buf);
output_length = (unsigned long) stat_buf.st_size;
utime(outname, &utim); /* set timestamp (no big deal if fails) */
if (new_time_stamp == 0) {
/* set file timestamp (no big deal if fails) */
utime(outname, &utim);
}
#else
input_length = (unsigned long) filesize(inname);
output_length = (unsigned long) filesize(outname);
#endif
if (verbose > 0) {
total_input_length += input_length + output_length;
if (!already_crushed && !image_is_immutable) {
@@ -4589,6 +4594,7 @@ int main(int argc, char *argv[])
fprintf(STDERR, " Number of open files=%d\n",
number_of_open_files);
}
}
if (pngcrush_mode == DEFAULT_MODE) {
@@ -5830,6 +5836,12 @@ 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. Default is to"},
{2, " reproduce the input file modification time."},
{2, ""},
#ifdef PNG_tRNS_SUPPORTED
{0, " -trns_array n trns[0] trns[1] .. trns[n-1]"},
{2, ""},