Commit 019a9de2 authored by Mathieu Malaterre's avatar Mathieu Malaterre

Import Debian changes 1.4.0-1

jpegoptim (1.4.0-1) unstable; urgency=low

  * New upstream
  * Add patch to allow compilation. Closes: #748768
parents c0281b7c 09d2447c
......@@ -3,5 +3,8 @@ config.h
config.status
config.log
jpegoptim
jpegoptim.prn
jpegoptim.ps
jpegoptim.txt
*.o
*.jpg
......@@ -3,7 +3,7 @@
#
# Makefile for jpegoptim
#
Version = 1.3.1
Version = 1.4.0
PKGNAME = jpegoptim
SHELL = /bin/sh
......@@ -50,7 +50,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
DIRNAME = $(shell basename `pwd`)
DISTNAME = $(PKGNAME)-$(Version)
OBJS = $(PKGNAME).o @GNUGETOPT@
OBJS = $(PKGNAME).o jpegdest.o misc.o @GNUGETOPT@
$(PKGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PKGNAME) $(OBJS) $(LDFLAGS) $(LIBS)
......
Jpegoptim v1.3.1 Copyright (c) Timo Kokkonen, 1996-2014.
Jpegoptim v1.4.0 - Copyright (c) Timo Kokkonen, 1996-2014. All Rights Reserved.
REQUIREMENTS
......@@ -17,8 +17,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.3.1.tar.gz | tar xf -
cd jpegoptim-1.3.1
zcat jpegoptim-1.4.0.tar.gz | tar xf -
cd jpegoptim-1.4.0
./configure
make
make strip
......@@ -26,6 +26,12 @@ INSTALLATION
HISTORY
v1.4.0 - use memory (instead of temporary files) during optimization,
support for reading input from stdin (and sending output to
stdout),
report also libjpeg version when --version option used,
new option --strip-none to preserve "all" markers,
other minor fixes & cleanup
v1.3.1 - XMP marker support and new --csv option (by Matteo Croce),
use DESTDIR instead of INSTALL_ROOT (by Samuli Suominen),
changes to make compiling under Win32 and Win64
......@@ -73,5 +79,5 @@ LATEST VERSION
Timo <tjko@iki.fi>
24-Mar-2014 $Id$
11-May-2014 $Id$
jpegoptim (1.4.0-1) unstable; urgency=low
* New upstream
* Add patch to allow compilation. Closes: #748768
-- Mathieu Malaterre <malat@debian.org> Thu, 22 May 2014 11:43:53 +0200
jpegoptim (1.3.1-1) unstable; urgency=low
* New upstream. Closes: #708630, #727906
......
Description: fix compilation error
Author: Mathieu Malaterre <malat@debian.org>
Origin: upstream, https://github.com/tjko/jpegoptim/commit/1d0804a73d6e3490d9f02e0eef90dffac4419007
Bug-Debian: http://bugs.debian.org/748768
--- jpegoptim-1.4.0.orig/jpegoptim.c
+++ jpegoptim-1.4.0/jpegoptim.c
@@ -576,7 +576,7 @@ int main(int argc, char **argv)
(dinfo.progressive_mode?'P':'N'));
if (!csv) {
- fprintf(LOG_FH,marker_str);
+ fprintf(LOG_FH,"%s",marker_str);
if (dinfo.saw_Adobe_marker) fprintf(LOG_FH,"Adobe ");
if (dinfo.saw_JFIF_marker) fprintf(LOG_FH,"JFIF ");
}
/*
* jpegdest.c
*
* Copyright (C) 2014 Timo Kokkonen
* All Rights Reserved.
*
* custom libjpeg "Destination Manager" for saving into RAM
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jpeglib.h>
#include <jerror.h>
#include "jpegoptim.h"
/* custom jpeg destination manager object */
typedef struct {
struct jpeg_destination_mgr pub; /* public fields */
unsigned char **buf_ptr;
size_t *bufsize_ptr;
size_t incsize;
unsigned char *buf;
size_t bufsize;
} jpeg_memory_destination_mgr;
typedef jpeg_memory_destination_mgr* jpeg_memory_destination_ptr;
void jpeg_memory_init_destination (j_compress_ptr cinfo)
{
jpeg_memory_destination_ptr dest = (jpeg_memory_destination_ptr) cinfo->dest;
dest->pub.next_output_byte = dest->buf;
dest->pub.free_in_buffer = dest->bufsize;
}
boolean jpeg_memory_empty_output_buffer (j_compress_ptr cinfo)
{
jpeg_memory_destination_ptr dest = (jpeg_memory_destination_ptr) cinfo->dest;
unsigned char *newbuf;
/* abort if incsize is 0 (no expansion of buffer allowed) */
if (dest->incsize == 0) ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 42);
/* otherwise, try expanding buffer... */
newbuf = realloc(dest->buf,dest->bufsize + dest->incsize);
if (!newbuf) ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 42);
dest->pub.next_output_byte = newbuf + dest->bufsize;
dest->pub.free_in_buffer = dest->incsize;
dest->buf = newbuf;
dest->bufsize += dest->incsize;
dest->incsize *= 2;
return TRUE;
}
void jpeg_memory_term_destination (j_compress_ptr cinfo)
{
jpeg_memory_destination_ptr dest = (jpeg_memory_destination_ptr) cinfo->dest;
*dest->buf_ptr = dest->buf;
*dest->bufsize_ptr = dest->bufsize - dest->pub.free_in_buffer;
}
void jpeg_memory_dest (j_compress_ptr cinfo, unsigned char **bufptr, size_t *bufsizeptr, size_t incsize)
{
jpeg_memory_destination_ptr dest;
if (!cinfo || !bufptr || !bufsizeptr)
fatal("invalid call to jpeg_memory_dest()");
if (!*bufptr || *bufsizeptr == 0)
fatal("invalid buffer passed to jpeg_memory_dest()");
/* allocate destination manager object for compress object, if needed */
if (!cinfo->dest) {
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ( (j_common_ptr) cinfo,
JPOOL_PERMANENT,
sizeof(jpeg_memory_destination_mgr) );
}
dest = (jpeg_memory_destination_ptr)cinfo->dest;
dest->buf_ptr = bufptr;
dest->buf = *bufptr;
dest->bufsize_ptr = bufsizeptr;
dest->bufsize = *bufsizeptr;
dest->incsize = incsize;
dest->pub.init_destination = jpeg_memory_init_destination;
dest->pub.empty_output_buffer = jpeg_memory_empty_output_buffer;
dest->pub.term_destination = jpeg_memory_term_destination;
}
.TH JPEGOPTIM 1 "24 Mar 2014"
.TH JPEGOPTIM 1 "11 May 2014"
.UC 4
.SH NAME
jpegoptim \- utility to optimize/compress JPEG/JFIF files.
......@@ -103,8 +103,15 @@ all input files to normal (non-progressive) JPEGs when used with --force option.
.TP 0.6i
.B -s, --strip-all
Strip all (Comment & Exif) markers from output file. (NOTE! by default
only Comment & Exif markers are kept, everything else is discarded)
Strip all markers from output file. (NOTE! by default
only Comment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything else is discarded).
Output JPEG still likely will contains one or two markers (JFIF and Adobe APP14) depending
on colorspace used in the image, as these markers are generated by the libjpeg encoder
automatically.
.TP 0.6i
.B --strip-none
Preserve "all" markers in the image. This will leave all markers untouched in the image,
except JFIF (APP0) and Adobe (APP14) markers as those get regenerated by the libjpeg library.
.TP 0.6i
.B --strip-com
Strip Comment (COM) markers from output file.
......@@ -113,7 +120,7 @@ Strip Comment (COM) markers from output file.
Strip EXIF markers from output file.
.TP 0.6i
.B --strip-iptc
Strip IPTC markers from output file.
Strip IPTC / Adobe Photoshop (APP13) markers from output file.
.TP 0.6i
.B --strip-icc
Strip ICC profiles from output file.
......@@ -122,6 +129,21 @@ Strip ICC profiles from output file.
Strip XMP profiles from output file.
.TP 0.6i
.B --stdout
Send output image to standard output. Note, if optimization didn't create smaller file
than the input file, then no output (image) is sent to standard output. (Option
.B -f
can be used to force output of image always, even if optimized image was not smaller than input).
.TP 0.6i
.B --stdin
Read input image from standard input. When this option is used then only one
image is read from standard output. Any (other) input files specified on command
line are ignored.
Note, if input file '-' is seen on command line then standard input is also assumed.
.SH BUGS
......
This diff is collapsed.
/* jpegoptim.h
*
* JPEGoptim headers
*/
#ifndef _JPEGOPTIM_H
#define _JPEGOPTIM_H 1
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#include "win32_compat.h"
#define DIR_SEPARATOR_C '\\'
#define DIR_SEPARATOR_S "\\"
#else
#include <sys/param.h>
#include <utime.h>
#define DIR_SEPARATOR_C '/'
#define DIR_SEPARATOR_S "/"
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <jpeglib.h>
#ifdef BROKEN_METHODDEF
#undef METHODDEF
#define METHODDEF(x) static x
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define EXIF_JPEG_MARKER JPEG_APP0+1
#define EXIF_IDENT_STRING "Exif\000\000"
#define EXIF_IDENT_STRING_SIZE 6
#define IPTC_JPEG_MARKER JPEG_APP0+13
#define ICC_JPEG_MARKER JPEG_APP0+2
#define ICC_IDENT_STRING "ICC_PROFILE\0"
#define ICC_IDENT_STRING_SIZE 12
#define XMP_JPEG_MARKER JPEG_APP0+1
#define XMP_IDENT_STRING "http://ns.adobe.com/xap/1.0/\000"
#define XMP_IDENT_STRING_SIZE 29
#define PROGRAMNAME "jpegoptim"
extern int verbose_mode;
extern int quiet_mode;
/* misc.c */
int delete_file(char *name);
long file_size(FILE *fp);
int is_directory(const char *path);
int is_file(const char *filename, struct stat *st);
int file_exists(const char *pathname);
int rename_file(const char *old_path, const char *new_path);
char *splitdir(const char *pathname, char *buf, int buflen);
char *splitname(const char *pathname, char *buf, int buflen);
void fatal(const char *format, ...);
void warn(const char *format, ...);
/* jpegdest.c */
void jpeg_memory_dest (j_compress_ptr cinfo, unsigned char **bufptr, size_t *bufsizeptr, size_t incsize);
#ifdef __cplusplus
}
#endif
#endif /* _JPEGOPTIM_H */
/* misc.c
*
* Copyright (C) 1996-2014 Timo Kokkonen
* All Rights Reserved.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "jpegoptim.h"
int delete_file(char *name)
{
int retval;
if (!name) return -1;
if (verbose_mode > 1 && !quiet_mode) fprintf(stderr,"deleting: %s\n",name);
if ((retval=unlink(name)) && !quiet_mode)
fprintf(stderr,PROGRAMNAME ": error removing file: %s\n",name);
return retval;
}
long file_size(FILE *fp)
{
struct stat buf;
if (!fp) return -1;
if (fstat(fileno(fp),&buf)) return -2;
return (long)buf.st_size;
}
int is_directory(const char *pathname)
{
struct stat buf;
if (!pathname) return 0;
if (stat(pathname,&buf) != 0) return 0;
if (S_ISDIR(buf.st_mode)) return 1;
return 0;
}
int is_file(const char *filename, struct stat *st)
{
struct stat buf;
if (!filename) return 0;
if (lstat(filename,&buf) != 0) return 0;
if (st) *st=buf;
if (S_ISREG(buf.st_mode)) return 1;
return 0;
}
int file_exists(const char *pathname)
{
struct stat buf;
if (!pathname) return 0;
if (stat(pathname,&buf) != 0) return 0;
return 1;
}
int rename_file(const char *old_path, const char *new_path)
{
if (!old_path || !new_path) return -1;
#ifdef WIN32
if (file_exists(new_path)) delete_file(new_path);
#endif
return rename(old_path,new_path);
}
char *splitdir(const char *pathname, char *buf, int buflen)
{
char *s = NULL;
int size = 0;
if (!pathname || !buf || buflen < 2) return NULL;
if ((s = strrchr(pathname,DIR_SEPARATOR_C))) size = (s-pathname)+1;
if (size >= buflen) return NULL;
if (size > 0) memcpy(buf,pathname,size);
buf[size]=0;
return buf;
}
char *splitname(const char *pathname, char *buf, int buflen)
{
const char *s = NULL;
int size = 0;
if (!pathname || !buf || buflen < 2) return NULL;
if ((s = strrchr(pathname,DIR_SEPARATOR_C))) {
s++;
} else {
s=pathname;
}
size=strlen(s);
if (size >= buflen) return NULL;
if (size > 0) memcpy(buf,s,size);
buf[size]=0;
return buf;
}
void fatal(const char *format, ...)
{
va_list args;
fprintf(stderr, PROGRAMNAME ": ");
va_start(args,format);
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr,"\n");
fflush(stderr);
exit(3);
}
void warn(const char *format, ...)
{
va_list args;
if (quiet_mode) return;
fprintf(stderr, PROGRAMNAME ": ");
va_start(args,format);
vfprintf(stderr, format, args);
va_end(args);
fprintf(stderr,"\n");
fflush(stderr);
}
/* eof */
Summary: Utility for optimizing/compressing JPEG files.
Name: jpegoptim
Version: 1.3.0
Version: 1.4.0
Release: 1
License: GPL
Group: Applications/Multimedia
......
......@@ -27,7 +27,8 @@ extern "C" {
#define getuid(x) 0
#define geteuid() 0
#define chown(outfname,st_uid,st_gid) 0
#define S_ISREG(x) 1
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#ifndef HOST_TYPE
#if _WIN64
......
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