Commit 12300a63 authored by Mathieu Malaterre's avatar Mathieu Malaterre

Import Upstream version 1.4.6

parent 5cbc902b
jpegoptim
=========
Copyright (C) 1996-2016 Timo Kokkonen <tjko@iki.fi>
Copyright (C) 1996-2018 Timo Kokkonen <tjko@iki.fi>
This program is free software; you can redistribute it
......
......@@ -3,7 +3,7 @@
#
# Makefile for jpegoptim
#
Version = 1.4.4
Version = 1.4.6
PKGNAME = jpegoptim
SHELL = /bin/sh
......@@ -35,7 +35,8 @@ mandir = @mandir@
CC = @CC@
XCPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@ $(XCPPFLAGS) $(DEFS)
#CFLAGS += -Wall -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
#CFLAGS += -Wall -Wformat -Werror=format-security
#CFLAGS += -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fsanitize=address,undefined
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
STRIP = strip
......
Jpegoptim v1.4.4 - Copyright (c) Timo Kokkonen, 1996-2016. All Rights Reserved.
Jpegoptim v1.4.6 - Copyright (C) Timo Kokkonen, 1996-2018. All Rights Reserved.
REQUIREMENTS
......@@ -19,8 +19,8 @@ INSTALLATION
tar file, make necessary changes to the Makefile, and then
compile the program. You may wanna do something like this:
zcat jpegoptim-1.4.4.tar.gz | tar xf -
cd jpegoptim-1.4.4
zcat jpegoptim-1.4.6.tar.gz | tar xf -
cd jpegoptim-1.4.6
./configure
make
make strip
......@@ -28,6 +28,11 @@ INSTALLATION
HISTORY
v1.4.6 - fix double free introduced in previous release
v1.4.5 - fix --overwrite option,
better error reporting for -d option,
fix memcmp() potentially reading past end of buffer,
some minor fixes
v1.4.4 - more detailed error messages (thanks to Denis Fateyev),
CMake support (thanks to Ghostkeeper),
other minor fixes
......@@ -92,5 +97,5 @@ LATEST VERSION
Timo <tjko@iki.fi>
15-Aug-2016 $Id$
17-Apr-2018 $Id$
......@@ -62,6 +62,7 @@ boolean jpeg_memory_empty_output_buffer (j_compress_ptr cinfo)
dest->pub.next_output_byte = newbuf + dest->bufsize;
dest->pub.free_in_buffer = dest->incsize;
*dest->buf_ptr = newbuf;
dest->buf = newbuf;
dest->bufsize += dest->incsize;
dest->incsize *= 2;
......
.TH JPEGOPTIM 1 "15 Aug 2016"
.TH JPEGOPTIM 1 "17 Apr 2018"
.UC 4
.SH NAME
jpegoptim \- utility to optimize/compress JPEG/JFIF files.
......@@ -170,7 +170,7 @@ jpeginfo(1)
Timo Kokkonen <tjko@iki.fi>
.SH COPYING
Copyright (C) 1996-2016 Timo Kokkonen
Copyright (C) 1996-2018 Timo Kokkonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
......@@ -34,8 +34,8 @@
#include "jpegoptim.h"
#define VERSIO "1.4.4"
#define COPYRIGHT "Copyright (c) 1996-2016, Timo Kokkonen"
#define VERSIO "1.4.6"
#define COPYRIGHT "Copyright (C) 1996-2018, Timo Kokkonen"
#define LOG_FH (logs_to_stdout ? stdout : stderr)
......@@ -97,6 +97,7 @@ struct option long_options[] = {
{"dest",1,0,'d'},
{"force",0,0,'f'},
{"version",0,0,'V'},
{"overwrite",0,0,'o'},
{"preserve",0,0,'p'},
{"preserve-perms",0,0,'P'},
{"strip-all",0,0,'s'},
......@@ -198,7 +199,10 @@ void print_version()
printf(PROGRAMNAME " v%s %s\n",VERSIO,HOST_TYPE);
printf(COPYRIGHT "\n");
printf(COPYRIGHT "\n\n");
printf("This program comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
"and you are welcome to redistirbute it under certain conditions.\n"
"See the GNU General Public License for more details.\n\n");
if (!(err=jpeg_std_error(&jcerr)))
fatal("jpeg_std_error() failed");
......@@ -242,15 +246,18 @@ void write_markers(struct jpeg_decompress_struct *dinfo,
write_marker++;
if (save_exif && mrk->marker == EXIF_JPEG_MARKER &&
mrk->data_length >= EXIF_IDENT_STRING_SIZE &&
!memcmp(mrk->data,EXIF_IDENT_STRING,EXIF_IDENT_STRING_SIZE))
write_marker++;
if (save_icc && mrk->marker == ICC_JPEG_MARKER &&
!memcmp(mrk->data,ICC_IDENT_STRING,ICC_IDENT_STRING_SIZE))
mrk->data_length >= ICC_IDENT_STRING_SIZE &&
!memcmp(mrk->data,ICC_IDENT_STRING,ICC_IDENT_STRING_SIZE))
write_marker++;
if (save_xmp && mrk->marker == XMP_JPEG_MARKER &&
!memcmp(mrk->data,XMP_IDENT_STRING,XMP_IDENT_STRING_SIZE))
mrk->data_length >= XMP_IDENT_STRING_SIZE &&
!memcmp(mrk->data,XMP_IDENT_STRING,XMP_IDENT_STRING_SIZE))
write_marker++;
if (strip_none) write_marker++;
......@@ -301,7 +308,7 @@ int main(int argc, char **argv)
char tmpfilename[MAXPATHLEN],tmpdir[MAXPATHLEN];
char newname[MAXPATHLEN], dest_path[MAXPATHLEN];
volatile int i;
int c,j, tmpfd, searchcount, searchdone;
int c,j, searchcount, searchdone;
int opt_index = 0;
long insize = 0, outsize = 0, lastsize = 0;
int oldquality;
......@@ -369,9 +376,10 @@ int main(int argc, char **argv)
}
break;
case 'd':
if (realpath(optarg,dest_path)==NULL || !is_directory(dest_path)) {
fatal("invalid argument for option -d, --dest");
}
if (realpath(optarg,dest_path)==NULL)
fatal("invalid destination directory: %s", optarg);
if (!is_directory(dest_path))
fatal("destination not a directory: %s", dest_path);
strncat(dest_path,DIR_SEPARATOR_S,sizeof(dest_path)-strlen(dest_path)-1);
if (verbose_mode)
......@@ -485,13 +493,13 @@ int main(int argc, char **argv)
/* loop to process the input files */
i=1;
i=(optind > 0 ? optind : 1);
do {
if (stdin_mode) {
infile=stdin;
set_filemode_binary(infile);
} else {
if (!argv[i][0]) continue;
if (i >= argc || !argv[i][0]) continue;
if (argv[i][0]=='-') continue;
if (strlen(argv[i]) >= MAXPATHLEN) {
warn("skipping too long filename: %s",argv[i]);
......@@ -565,6 +573,7 @@ int main(int argc, char **argv)
marker_in_size+=cmarker->data_length;
if (cmarker->marker == EXIF_JPEG_MARKER &&
cmarker->data_length >= EXIF_IDENT_STRING_SIZE &&
!memcmp(cmarker->data,EXIF_IDENT_STRING,EXIF_IDENT_STRING_SIZE))
strncat(marker_str,"Exif ",sizeof(marker_str)-strlen(marker_str)-1);
......@@ -572,10 +581,12 @@ int main(int argc, char **argv)
strncat(marker_str,"IPTC ",sizeof(marker_str)-strlen(marker_str)-1);
if (cmarker->marker == ICC_JPEG_MARKER &&
cmarker->data_length >= ICC_IDENT_STRING_SIZE &&
!memcmp(cmarker->data,ICC_IDENT_STRING,ICC_IDENT_STRING_SIZE))
strncat(marker_str,"ICC ",sizeof(marker_str)-strlen(marker_str)-1);
if (cmarker->marker == XMP_JPEG_MARKER &&
cmarker->data_length >= XMP_IDENT_STRING_SIZE &&
!memcmp(cmarker->data,XMP_IDENT_STRING,XMP_IDENT_STRING_SIZE))
strncat(marker_str,"XMP ",sizeof(marker_str)-strlen(marker_str)-1);
......@@ -820,14 +831,14 @@ int main(int argc, char **argv)
/* rely on mkstemps() to create us temporary file safely... */
snprintf(tmpfilename,sizeof(tmpfilename),
"%sjpegoptim-%d-%d.XXXXXX.tmp", tmpdir, (int)getuid(), (int)getpid());
if ((tmpfd = mkstemps(tmpfilename,4)) < 0)
int tmpfd = mkstemps(tmpfilename,4);
if (tmpfd < 0)
fatal("%s, error creating temp file %s: mkstemps() failed",(stdin_mode?"stdin":argv[i]),tmpfilename);
if ((outfile=fdopen(tmpfd,"wb"))==NULL)
#else
/* if platform is missing mkstemps(), try to create at least somewhat "safe" temp file... */
snprintf(tmpfilename,sizeof(tmpfilename),
"%sjpegoptim-%d-%d.%ld.tmp", tmpdir, (int)getuid(), (int)getpid(),(long)time(NULL));
tmpfd=0;
if ((outfile=fopen(tmpfilename,"wb"))==NULL)
#endif
fatal("error opening temporary file: %s",tmpfilename);
......@@ -888,6 +899,7 @@ int main(int argc, char **argv)
average_count, average_rate/average_count, total_save);
jpeg_destroy_decompress(&dinfo);
jpeg_destroy_compress(&cinfo);
free(outbuffer);
return (decompress_err_count > 0 || compress_err_count > 0 ? 1 : 0);;
}
......
......@@ -61,7 +61,7 @@ extern int quiet_mode;
/* misc.c */
int delete_file(char *name);
int delete_file(const char *name);
long file_size(FILE *fp);
int is_directory(const char *path);
int is_file(const char *filename, struct stat *st);
......
......@@ -22,7 +22,7 @@
#include "jpegoptim.h"
int delete_file(char *name)
int delete_file(const char *name)
{
int retval;
......
Summary: Utility for optimizing/compressing JPEG files.
Name: jpegoptim
Version: 1.4.4
Version: 1.4.6
Release: 1
License: GPL
Group: Applications/Multimedia
......
......@@ -20,7 +20,7 @@ extern "C" {
#include <sys/utime.h>
#define snprintf _snprintf
#define lstat _stat
#define lstat stat
#define realpath(N,R) _fullpath((R),(N),MAXPATHLEN)
#define ftruncate(fildes,length) open(fildes, O_TRUNC|O_WRONLY)
......@@ -31,13 +31,19 @@ extern "C" {
#define getuid(x) 0
#define geteuid() 0
#define chown(outfname,st_uid,st_gid) 0
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISDIR
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef HOST_TYPE
#if _WIN64
#define HOST_TYPE "Win64"
#else if WIN32
#elif WIN32
#define HOST_TYPE "Win32"
#endif
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment