Commit 861370a4 authored by Mathieu Malaterre's avatar Mathieu Malaterre

Import Upstream version 1.2.5

parent bc1dbaaf
*.c ident
*.in ident
README ident
#########################################################################
# $Id: Makefile.in,v 1.8 2011/03/31 05:37:04 tjko Exp $
# $Id$
#
# Makefile for jpegoptim
#
Version = 1.2.4
Version = 1.2.5
PKGNAME = jpegoptim
SHELL = /bin/sh
......@@ -71,6 +71,10 @@ dist: clean_all
backup: dist
archive:
git archive --format tar --prefix ${DISTNAME}/ -o ../${DISTNAME}.tar master
gzip -v -9 ../${DISTNAME}.tar
install: all install.dirs install.man
$(INSTALL) -m 755 $(PKGNAME) $(INSTALL_ROOT)/$(bindir)/$(PKGNAME)
......
Jpegoptim v1.2.4 Copyright (c) Timo Kokkonen, 1996-2011.
Jpegoptim v1.2.5 Copyright (c) Timo Kokkonen, 1996-2013.
REQUIREMENTS
......@@ -17,8 +17,8 @@ INSTALLATION
tar file, make nesessary changes to the Makefile, and then
compile the program. You may wanna do something like this:
zcat jpegoptim-1.2.4.tar.gz | tar xf -
cd jpegoptim-1.2.4
zcat jpegoptim-1.2.5.tar.gz | tar xf -
cd jpegoptim-1.2.5
./configure
make
make strip
......@@ -26,6 +26,8 @@ INSTALLATION
HISTORY
v1.2.5 - safer temp file handling (if mkstemps() available),
patch to make "quiet mode" (-q) be quiet by Mathieu Malaterre
v1.2.4 - new -T / --treshold option by Matteo Croce,
minor fixes (potential memory leaks),
merged some patches from Debian jpegoptim package (1.2.3-2)
......@@ -51,8 +53,10 @@ LATEST VERSION
Latest version is always available from:
http://www.iki.fi/tjko/projects.html
Sources (GIT)
https://github.com/tjko/jpegoptim
Timo <tjko@iki.fi>
29-Mar-2011
30-Jan-2013 $Id$
/* config.h.in.
* $Id: config.h.in,v 1.2 2002/12/04 13:17:58 tjko Exp $
* $Id$
*
*/
......@@ -16,6 +16,9 @@
/* Define if you have the getopt_long function. */
#undef HAVE_GETOPT_LONG
/* Define if you have mkstemps function. */
#undef HAVE_MKSTEMPS
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
......
This diff is collapsed.
dnl $Id: configure.in,v 1.1 2002/12/04 00:25:44 tjko Exp $
dnl $Id$
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(jpegoptim.c)
......@@ -58,6 +58,7 @@ dnl Checks for library functions.
AC_CHECK_FUNCS(getopt_long, break, [GNUGETOPT="getopt.o getopt1.o"])
AC_SUBST(GNUGETOPT)
AC_CHECK_FUNCS(mkstemps)
dnl own tests
......
/*******************************************************************
* JPEGoptim
* Copyright (c) Timo Kokkonen, 1996-2011.
* Copyright (c) Timo Kokkonen, 1996-2013.
* All Rights Reserved.
*
* requires libjpeg.a (from JPEG Group's JPEG software
* release 6a or later...)
*
* $Id: jpegoptim.c,v 1.19 2011/04/03 04:16:39 tjko Exp $
* $Id$
*/
#ifdef HAVE_CONFIG_H
......@@ -36,7 +37,7 @@
#include <libgen.h>
#endif
#define VERSIO "1.2.4"
#define VERSIO "1.2.5"
#ifdef BROKEN_METHODDEF
#undef METHODDEF
......@@ -66,7 +67,7 @@ struct jpeg_decompress_struct dinfo;
struct jpeg_compress_struct cinfo;
struct my_error_mgr jcerr,jderr;
const char *rcsid = "$Id: jpegoptim.c,v 1.19 2011/04/03 04:16:39 tjko Exp $";
const char *rcsid = "$Id$";
struct option long_options[] = {
{"verbose",0,0,'v'},
......@@ -140,7 +141,7 @@ void p_usage(void)
{
if (!quiet_mode) {
fprintf(stderr,"jpegoptim v" VERSIO
" Copyright (c) Timo Kokkonen, 1996-2011.\n");
" Copyright (c) Timo Kokkonen, 1996-2013.\n");
fprintf(stderr,
"Usage: jpegoptim [options] <filenames> \n\n"
......@@ -300,7 +301,7 @@ int main(int argc, char **argv)
char tmpfilename[MAXPATHLEN],tmpdir[MAXPATHLEN];
char newname[MAXPATHLEN], dest_path[MAXPATHLEN];
volatile int i;
int c,j, err_count;
int c,j, err_count, tmpfd;
int opt_index = 0;
long insize,outsize;
double ratio;
......@@ -383,7 +384,7 @@ int main(int argc, char **argv)
break;
case 'V':
printf("jpegoptim v%s %s\n",VERSIO,HOST_TYPE);
printf("Copyright (c) Timo Kokkonen, 1996-2011.\n");
printf("Copyright (c) Timo Kokkonen, 1996-2013.\n");
exit(0);
break;
case 'o':
......@@ -457,8 +458,6 @@ int main(int argc, char **argv)
fatal("splitdir() failed!");
strncpy(newname,argv[i],sizeof(newname));
}
snprintf(tmpfilename,sizeof(tmpfilename),
"%sjpegoptim-%d-%d.tmp", tmpdir, (int)getuid(), (int)getpid());
}
retry_point:
......@@ -484,7 +483,9 @@ int main(int argc, char **argv)
continue;
}
if (!retry) { printf("%s ",argv[i]); fflush(stdout); }
if (!retry && !quiet_mode) {
printf("%s ",argv[i]); fflush(stdout);
}
/* prepare to decompress */
global_error_counter=0;
......@@ -518,7 +519,7 @@ int main(int argc, char **argv)
}
if (!retry) {
if (!retry && !quiet_mode) {
printf("%dx%d %dbit ",(int)dinfo.image_width,
(int)dinfo.image_height,(int)dinfo.num_components*8);
......@@ -552,7 +553,7 @@ int main(int argc, char **argv)
coef_arrays = jpeg_read_coefficients(&dinfo);
}
if (!retry) {
if (!retry && !quiet_mode) {
if (!global_error_counter) printf(" [OK] ");
else printf(" [WARNING] ");
fflush(stdout);
......@@ -574,17 +575,27 @@ int main(int argc, char **argv)
if (noaction) {
outfname=NULL;
if ((outfile=tmpfile())==NULL) fatal("error opening temp file");
if ((outfile=tmpfile())==NULL) fatal("error creating temp file: tmpfile() failed");
} else {
snprintf(tmpfilename,sizeof(tmpfilename),
"%sjpegoptim-%d-%d.XXXXXX.tmp", tmpdir, (int)getuid(), (int)getpid());
#ifdef HAVE_MKSTEMPS
if ((tmpfd = mkstemps(tmpfilename,4)) < 0)
fatal("error creating temp file: mkstemps() failed");
if ((outfile=fdopen(tmpfd,"w"))==NULL)
#else
tmpfd=0;
if ((outfile=fopen(tmpfilename,"w"))==NULL)
#endif
fatal("error opening temporary file");
outfname=tmpfilename;
if ((outfile=fopen(outfname,"w"))==NULL)
fatal("error opening target file");
}
if (setjmp(jcerr.setjmp_buffer)) {
jpeg_abort_compress(&cinfo);
jpeg_abort_decompress(&dinfo);
fclose(outfile);
outfile=NULL;
if (infile) fclose(infile);
printf(" [Compress ERROR]\n");
if (buf) {
......@@ -642,6 +653,7 @@ int main(int argc, char **argv)
fclose(infile);
outsize=file_size(outfile);
fclose(outfile);
outfile=NULL;
if (preserve_mode && !noaction) {
if (utime(outfname,&time_save) != 0) {
......@@ -650,6 +662,7 @@ int main(int argc, char **argv)
}
if (quality>=0 && outsize>=insize && !retry) {
if (!noaction) delete_file(outfname);
if (verbose_mode) printf("(retry w/lossless) ");
retry=1;
goto retry_point;
......@@ -657,19 +670,19 @@ int main(int argc, char **argv)
retry=0;
ratio=(insize-outsize)*100.0/insize;
printf("%ld --> %ld bytes (%0.2f%%), ",insize,outsize,ratio);
if (!quiet_mode) printf("%ld --> %ld bytes (%0.2f%%), ",insize,outsize,ratio);
average_count++;
average_rate+=(ratio<0 ? 0.0 : ratio);
if ((outsize < insize && ratio >= threshold) || force) {
total_save+=(insize-outsize)/1024.0;
printf("optimized.\n");
if (!quiet_mode) printf("optimized.\n");
if (noaction) continue;
if (verbose_mode > 1 && !quiet_mode)
fprintf(stderr,"renaming: %s to %s\n",outfname,newname);
if (rename(outfname,newname)) fatal("cannot rename temp file");
} else {
printf("skipped.\n");
if (!quiet_mode) printf("skipped.\n");
if (!noaction) delete_file(outfname);
}
......@@ -677,7 +690,7 @@ int main(int argc, char **argv)
} while (++i<argc);
if (totals_mode&&!quiet_mode)
if (totals_mode && !quiet_mode)
printf("Average ""compression"" (%ld files): %0.2f%% (%0.0fk)\n",
average_count, average_rate/average_count, total_save);
jpeg_destroy_decompress(&dinfo);
......
Summary: Utility for optimizing/compressing JPEG files.
Name: jpegoptim
Version: 1.2.3
Version: 1.2.5
Release: 1
License: GPL
Group: Applications/Multimedia
......
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