debian/0000775000000000000000000000000012252026442007167 5ustar debian/libjbig0.install0000664000000000000000000000002711740525356012251 0ustar usr/lib/*/libjbig.so.* debian/copyright0000664000000000000000000000347111740525356011140 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: jbigkit Source: http://www.cl.cam.ac.uk/~mgk25/jbigkit/ Files: * Copyright: 1995-2008 Dr. Marcus Kuhn License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". Files: debian/* Copyright: 2011 Michael van der Kolff License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". debian/libjbig0.symbols0000664000000000000000000000205212252026374012266 0ustar libjbig.so.0 libjbig0 #MINVER# arith_decode@Base 2.0 arith_decode_init@Base 2.0 arith_encode@Base 2.0 arith_encode_flush@Base 2.0 arith_encode_init@Base 2.0 jbg85_dec_end@Base 2.0 jbg85_dec_in@Base 2.0 jbg85_dec_init@Base 2.0 jbg85_enc_abort@Base 2.0 jbg85_enc_init@Base 2.0 jbg85_enc_lineout@Base 2.0 jbg85_enc_newlen@Base 2.0 jbg85_enc_options@Base 2.0 jbg85_strerror@Base 2.0 jbg85_version@Base 2.0 jbg_ceil_half@Base 2.0 jbg_dec_free@Base 2.0 jbg_dec_getheight@Base 2.0 jbg_dec_getimage@Base 2.0 jbg_dec_getsize@Base 2.0 jbg_dec_getsize_merged@Base 2.0 jbg_dec_getwidth@Base 2.0 jbg_dec_in@Base 2.0 jbg_dec_init@Base 2.0 jbg_dec_maxsize@Base 2.0 jbg_dec_merge_planes@Base 2.0 jbg_dppriv2int@Base 2.0 jbg_enc_free@Base 2.0 jbg_enc_init@Base 2.0 jbg_enc_layers@Base 2.0 jbg_enc_lrange@Base 2.0 jbg_enc_lrlmax@Base 2.0 jbg_enc_options@Base 2.0 jbg_enc_out@Base 2.0 jbg_int2dppriv@Base 2.0 jbg_newlen@Base 2.0 jbg_next_pscdms@Base 2.0 jbg_split_planes@Base 2.0 jbg_strerror@Base 2.0 jbg_stripes@Base 2.0 jbg_version@Base 2.0 debian/source/0000775000000000000000000000000011740525356010500 5ustar debian/source/format0000664000000000000000000000001411740525356011706 0ustar 3.0 (quilt) debian/pbmtojbg85.10000664000000000000000000000301311740525356011240 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.7. .TH PBMTOJBIG "1" "April 2012" "PBMtoJBIG converter 2.0 (T.85 version) --" "User Commands" .SH NAME PBMtoJBIG \- creates bi-level image entity (BIE) as output file .SH DESCRIPTION PBMtoJBIG converter 2.0 (T.85 version) \fB\-\-\fR creates bi\-level image entity (BIE) as output file .PP usage: pbmtojbg85 [] [ | \- []] .PP options: .TP \fB\-s\fR number height of a stripe .TP \fB\-m\fR number maximum adaptive template pixel horizontal offset (default 8) .TP \fB\-p\fR number options byte value: add TPBON=8, LRLTWO=64 (default 8 = TPBON) .TP \fB\-C\fR string add the provided string as a comment marker segment .TP \fB\-Y\fR yi yr announce in header initially the larger image height yi and then announce after line yr has been encoded the real height using NEWLEN marker (for testing NEWLEN and VLENGTH=1 function) .PP creates bi\-level image entity (BIE) as output file .PP usage: pbmtojbg85 [] [ | \- []] .PP options: .TP \fB\-s\fR number height of a stripe .TP \fB\-m\fR number maximum adaptive template pixel horizontal offset (default 8) .TP \fB\-p\fR number options byte value: add TPBON=8, LRLTWO=64 (default 8 = TPBON) .TP \fB\-C\fR string add the provided string as a comment marker segment .TP \fB\-Y\fR yi yr announce in header initially the larger image height yi and then announce after line yr has been encoded the real height using NEWLEN marker (for testing NEWLEN and VLENGTH=1 function) debian/changelog0000664000000000000000000000246612252026442011051 0ustar jbigkit (2.0-2ubuntu4) trusty; urgency=low * libjbig0.symbols: Fix symbols file to refer to the right library. -- Adam Conrad Wed, 11 Dec 2013 02:14:44 -0700 jbigkit (2.0-2ubuntu3) trusty; urgency=low * Fix header include. -- Matthias Klose Sat, 07 Dec 2013 19:25:40 +0100 jbigkit (2.0-2ubuntu2) trusty; urgency=medium * Allow the package to cross build, remove wrong libtool usage. * Build using hardening defaults. * Add a symbols file. -- Matthias Klose Sat, 07 Dec 2013 19:00:45 +0100 jbigkit (2.0-2ubuntu1) quantal; urgency=low * Fix a number of compiler warnings per feedback from Ubuntu security team (LP: #993304). -- Colin Watson Mon, 09 Jul 2012 11:57:58 +0100 jbigkit (2.0-2) unstable; urgency=low * Correct typo in new Makefile, so that libjbig.so now points to a file that exists (Closes: #667927) * Readd test target per Mathieu Malaterre's comments * Make test target work by forcing it to search the directory where the library was built. -- Michael van der Kolff Sun, 08 Apr 2012 19:12:41 +1000 jbigkit (2.0-1) unstable; urgency=low * Initial release (Closes: #656413) -- Michael van der Kolff Fri, 06 Apr 2012 07:05:15 +1000 debian/compat0000664000000000000000000000000211740525356010376 0ustar 8 debian/jbgtopbm85.10000664000000000000000000000170211740525356011243 0ustar .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.7. .TH JBIGTOPBM "1" "April 2012" "JBIGtoPBM converter 2.0 (T.85 version) --" "User Commands" .SH NAME JBIGtoPBM \- reads a bi-level image entity (BIE) as input file .SH DESCRIPTION JBIGtoPBM converter 2.0 (T.85 version) \fB\-\-\fR reads a bi\-level image entity (BIE) as input file .PP usage: jbgtopbm85 [ | \- []] .PP options: .TP \fB\-x\fR number maximum number of pixels per line for which memory is allocated (default: 8192) .TP \fB\-y\fR number interrupt decoder after this number of lines .TP \fB\-B\fR number input buffer size .PP reads a bi\-level image entity (BIE) as input file .PP usage: jbgtopbm85 [ | \- []] .PP options: .TP \fB\-x\fR number maximum number of pixels per line for which memory is allocated (default: 8192) .TP \fB\-y\fR number interrupt decoder after this number of lines .TP \fB\-B\fR number input buffer size debian/rules0000775000000000000000000000162012250660400010242 0ustar #!/usr/bin/make -f include /usr/share/dpkg/architecture.mk export DEB_HOST_MULTIARCH CFLAGS ?= $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS) LDFLAGS ?= $(shell dpkg-buildflags --get LDFLAGS) ifneq ($(DEB_HOST_MULTIARCH),$(DEB_BUILD_MULTIARCH)) CC = $(DEB_HOST_GNU_TYPE)-gcc export DEB_HOST_GNU_TYPE else CC = cc unexport DEB_HOST_GNU_TYPE endif %: dh $@ pkg_run = jbigkit-bin override_dh_auto_build: make CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" override_dh_installman: dh_installman -p$(pkg_run) debian/jbgtopbm85.1 debian/pbmtojbg85.1 debian/jbgtopbm85.1: help2man -n "reads a bi-level image entity (BIE) as input file" \ --no-discard-stderr --output=debian/jbgtopbm85.1 --no-info jbgtopbm85 debian/pbmtojbg85.1: help2man -n "creates bi-level image entity (BIE) as output file" \ --no-discard-stderr --output=debian/pbmtojbg85.1 --no-info pbmtojbg85 debian/libjbig-dev.install0000664000000000000000000000004311740525356012743 0ustar usr/include/* usr/lib/*/libjbig.so debian/control0000664000000000000000000000352412250655406010604 0ustar Source: jbigkit Priority: extra Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Michael van der Kolff Build-Depends: debhelper (>=8.1.3) Standards-Version: 3.9.3 Section: libs Homepage: http://www.cl.cam.ac.uk/~mgk25/jbigkit/ Vcs-Git: git://github.com/mvanderkolff/jbigkit-packaging.git Vcs-Browser: https://github.com/mvanderkolff/jbigkit-packaging Package: jbigkit-bin Section: graphics Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Suggests: netpbm Description: JBIGkit binaries JBIG-KIT provides a portable library of compression and decompression functions with a documented interface that you can include very easily into your image or document processing software. . This package contains the binaries from JBIG-KIT. Package: libjbig-dev Section: libdevel Architecture: any Multi-Arch: same Pre-Depends: multiarch-support Depends: libjbig0 (= ${binary:Version}), ${misc:Depends} Description: JBIGkit development files JBIG-KIT provides a portable library of compression and decompression functions with a documented interface that you can include very easily into your image or document processing software. . This package contains the headers for the library. . Please note: There is no statically linked library in this package, and what was previously two libraries with a single common file has been merged into one library (libjbig). Package: libjbig0 Section: libs Architecture: any Multi-Arch: same Pre-Depends: multiarch-support Depends: ${shlibs:Depends}, ${misc:Depends} Description: JBIGkit libraries JBIG-KIT provides a portable library of compression and decompression functions with a documented interface that you can include very easily into your image or document processing software. . This package contains the dynamically linked library. debian/README.source0000664000000000000000000000047011740526071011353 0ustar jbigkit for Debian ------------------ The Makefiles have been modified to use libtool and generate shared objects. Furthermore, a binary-incompatible change has been made - I just generate libjbig, not libjbig and libjbig85. -- Michael van der Kolff Fri, 06 Apr 2012 07:05:15 +1000 debian/watch0000664000000000000000000000017411740525356010233 0ustar # Compulsory line, this is a version 3 file version=3 http://www.cl.cam.ac.uk/~mgk25/download/ \ jbigkit-([\d\.]+).tar.gz debian/jbigkit-bin.install0000664000000000000000000000003711740525356012761 0ustar usr/bin/* usr/share/man/man1/* debian/README.Debian0000664000000000000000000000052311740525356011241 0ustar jbigkit for Debian ------------------ JBIG1 is, according to http://www.cl.cam.ac.uk/~mgk25/jbigkit/patents/ , not subject to patent claims except in the USA, where it is subject to a Mitsubishi patent until 2012-04-04. IANAL, so take that for what it's worth. -- mvanderkolff Mon, 30 May 2011 13:17:10 +1000 debian/libjbig0.shlibs0000664000000000000000000000002311740525356012063 0ustar libjbig 0 libjbig0 debian/docs0000664000000000000000000000000511740525356010046 0ustar TODO debian/patches/0000775000000000000000000000000012250664026010622 5ustar debian/patches/shared-lib.diff0000664000000000000000000001363512250664026013476 0ustar Subject: Build library with libtool Author: Michael van der Kolff Forwarded: no Upstream Makefile is barebones, and doesn't make any shared libraries. This part actually builds the libraries. Index: b/libjbig/Makefile =================================================================== --- a/libjbig/Makefile +++ b/libjbig/Makefile @@ -2,34 +2,41 @@ # $Id: Makefile 1285 2008-08-18 13:36:45Z mgk25 $ # Select an ANSI/ISO C compiler here, GNU gcc is recommended -CC = gcc +CC = cc # Options for the compiler: A high optimization level is suggested -CFLAGS = -g -O -Wall -ansi -pedantic # --coverage +CCFLAGS = -g -O2 -Wall -ansi -pedantic $(CFLAGS) # --coverage -all: libjbig.a tstcodec tstcodec85 +.PHONY: all clean test -tstcodec: tstcodec.o jbig.o jbig_ar.o - $(CC) $(CFLAGS) -o tstcodec $+ +%.o: %.c + $(CC) $(CCFLAGS) -c $< +%.pic_o: %.c + $(CC) -fPIC $(CCFLAGS) -c -o $@ $< -tstcodec85: tstcodec85.o jbig85.o jbig_ar.o - $(CC) $(CFLAGS) -o tstcodec85 $+ +all: libjbig.a libjbig.so -libjbig.a: jbig.o jbig_ar.o - rm -f libjbig.a - ar rc libjbig.a jbig.o jbig_ar.o - -ranlib libjbig.a +tstcodec: tstcodec.o libjbig.a + $(CC) $(LDFLAGS) $(CCFLAGS) -o tstcodec $+ -libjbig85.a: jbig85.o jbig_ar.o - rm -f libjbig85.a - ar rc libjbig85.a jbig85.o jbig_ar.o - -ranlib libjbig85.a +tstcodec85: tstcodec85.o libjbig.a + $(CC) $(LDFLAGS) $(CCFLAGS) -o tstcodec85 $+ + +libjbig.a: jbig.o jbig_ar.o jbig85.o + $(if $(DEB_HOST_GNU_TYPE),$(DEB_HOST_GNU_TYPE)-ar,ar) cru \ + libjbig.a jbig.o jbig_ar.o jbig85.o + $(if $(DEB_HOST_GNU_TYPE),$(DEB_HOST_GNU_TYPE)-ranlib,ranlib) \ + libjbig.a + +libjbig.so: jbig.pic_o jbig_ar.pic_o jbig85.pic_o + $(CC) -shared $(LDFLAGS) -Wl,-soname,libjbig.so.0 -o libjbig.so.0 $+ + ln -sf libjbig.so.0 libjbig.so jbig.o: jbig.c jbig.h jbig_ar.h jbig85.o: jbig85.c jbig85.h jbig_ar.h jbig_ar.o: jbig_ar.c jbig_ar.h -tstcodec.o: tstcodec.c jbig.h -tstcodec85.o: tstcodec85.c jbig85.h +tstcodec.o: tstcodec.c libjbig.a +tstcodec85.o: tstcodec85.c libjbig.a jbig.pot: jbig.c xgettext -o$@ -k_ \ @@ -44,5 +51,5 @@ ./tstcodec $@ clean: - rm -f *.{o,gcda,gcno,gcov} *~ core gmon.out dbg_d\=??.pbm t82test.pbm + rm -f *.gcda *.gcno *.gcov *.so* *.a *.la *.o *.pic_o *~ core gmon.out dbg_d\=??.pbm t82test.pbm rm -f tstcodec tstcodec85 Index: b/Makefile =================================================================== --- a/Makefile +++ b/Makefile @@ -2,28 +2,26 @@ # $Id: Makefile 1303 2008-08-30 20:16:20Z mgk25 $ # Select an ANSI/ISO C compiler here, GNU gcc is recommended -CC = gcc +CC = cc # Options for the compiler: A high optimization level is suggested CCFLAGS = -O2 -W #CCFLAGS = -O -g -W -Wall -ansi -pedantic #-DDEBUG # developer only -CFLAGS = $(CCFLAGS) -I../libjbig - VERSION=2.0 .PHONY: all lib pbm test clean install all: lib pbm lib: - (cd libjbig; make "CC=$(CC)" "CFLAGS=$(CFLAGS)") + (cd libjbig; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)") pbm: lib - (cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)") + (cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)") test: lib pbm - (cd libjbig; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test) - (cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test) + (cd libjbig; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" test) + (cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" test) clean: rm -f *~ core @@ -32,10 +30,9 @@ install: all install -d $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) - install -s -m 644 libjbig/.libs/*.so.*.*.* libjbig/.libs/*.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) - install -m 644 libjbig/.libs/*.la $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) + install -s -m 644 libjbig/*.so.* libjbig/*.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) /sbin/ldconfig -n $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) - ln -s libjbig.so.0.0.0 $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libjbig.so + ln -s libjbig.so.0 $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libjbig.so install -d $(DESTDIR)/usr/include install -m 644 libjbig/*.h $(DESTDIR)/usr/include install -d $(DESTDIR)/usr/bin Index: b/pbmtools/Makefile =================================================================== --- a/pbmtools/Makefile +++ b/pbmtools/Makefile @@ -2,29 +2,32 @@ # $Id: Makefile 1293 2008-08-25 22:26:39Z mgk25 $ # Select an ANSI/ISO C compiler here, e.g. GNU gcc is recommended -CC = gcc +CC = cc # Options for the compiler -CFLAGS = -g -Wall -ansi -pedantic -I../libjbig # --coverage -export LD_LIBRARY_PATH = ../libjbig/.libs +CCFLAGS = -g -Wall -ansi -pedantic -I../libjbig $(CFLAGS) # --coverage +export LD_LIBRARY_PATH = ../libjbig .PHONY: all test test82 test85 .SUFFIXES: .1 .5 .txt $(SUFFIXES) +%.o: %.c + $(CC) $(CCFLAGS) -c $< + all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 \ pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig/.libs -ljbig + $(CC) $(LDFLAGS) $(CCFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig/.libs -ljbig + $(CC) $(LDFLAGS)$(CCFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig/.libs -ljbig + $(CC) $(LDFLAGS)$(CCFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig/.libs -ljbig + $(CC) $(LDFLAGS)$(CCFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h @@ -89,7 +92,7 @@ cmp test-$(IMG).pgm ../examples/$(IMG).pgm test85: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 test-t82.pbm - export LD_LIBRARY_PATH=`pwd`/../libjbig/.libs + export LD_LIBRARY_PATH=`pwd`/../libjbig echo $(LD_LIBRARY_PATH) make IMG=t82 "OPTIONSP=-p 0" dotest85 make IMG=t82 "OPTIONSP=-p 8" dotest85 debian/patches/allNewMainMakefile.diff0000664000000000000000000000312311740525356015145 0ustar Subject: Give a proper Makefile for the upstream package Author: Michael van der Kolff Forwarded: no Upstream Makefile is barebones, and doesn't make any shared libraries. With some extra effort, this does. --- a/Makefile +++ b/Makefile @@ -11,9 +11,9 @@ CFLAGS = $(CCFLAGS) -I../libjbig VERSION=2.0 +.PHONY: all lib pbm test clean install all: lib pbm - @echo "Enter 'make test' in order to start some automatic tests." lib: (cd libjbig; make "CC=$(CC)" "CFLAGS=$(CFLAGS)") @@ -30,9 +30,15 @@ (cd libjbig; make clean) (cd pbmtools; make clean) -distribution: clean - rm -f libjbig/libjbig*.a - (cd ..; tar -c -v --exclude .svn -f jbigkit-$(VERSION).tar jbigkit ; \ - gzip -9f jbigkit-$(VERSION).tar ) - scp ../jbigkit-$(VERSION).tar.gz slogin-serv1.cl.cam.ac.uk:public_html/download/ - scp CHANGES slogin-serv1.cl.cam.ac.uk:public_html/jbigkit/ +install: all + install -d $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) + install -s -m 644 libjbig/.libs/*.so.*.*.* libjbig/.libs/*.a $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) + install -m 644 libjbig/.libs/*.la $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) + /sbin/ldconfig -n $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) + ln -s libjbig.so.0.0.0 $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libjbig.so + install -d $(DESTDIR)/usr/include + install -m 644 libjbig/*.h $(DESTDIR)/usr/include + install -d $(DESTDIR)/usr/bin + install -s -m 755 pbmtools/jbgtopbm pbmtools/jbgtopbm85 pbmtools/pbmtojbg pbmtools/pbmtojbg85 $(DESTDIR)/usr/bin + install -d $(DESTDIR)/usr/share/man/man1 + install -m 644 pbmtools/*.1 $(DESTDIR)/usr/share/man/man1 debian/patches/warnings.diff0000664000000000000000000002044111776534460013317 0ustar Subject: Fix several compiler warnings Author: Colin Watson Forwarded: no Index: b/libjbig/tstcodec.c =================================================================== --- a/libjbig/tstcodec.c +++ b/libjbig/tstcodec.c @@ -399,7 +399,7 @@ for (i = 0; i < 16 * 16 && !trouble; i++) { pix = arith_decode(sd, (t82cx[i >> 4] >> ((15 - i) & 15)) & 1); if (pix < 0) { - printf("Problem at pixel %ld, byte %d.\n\n", + printf("Problem at pixel %ld, byte %td.\n\n", i+1, sd->pscd_ptr - sd->pscd_end); trouble++; break; @@ -411,7 +411,7 @@ } } if (!trouble && sd->pscd_ptr != sd->pscd_end - 2) { - printf("%d bytes left after decoder finished.\n\n", + printf("%td bytes left after decoder finished.\n\n", sd->pscd_end - sd->pscd_ptr - 2); trouble++; } @@ -439,7 +439,7 @@ pix = arith_decode(sd, (t82cx[i >> 4] >> ((15 - i) & 15)) & 1); } if (pix < 0) { - printf("Problem at pixel %ld, byte %d.\n\n", + printf("Problem at pixel %ld, byte %td.\n\n", i+1, sd->pscd_ptr - sd->pscd_end); trouble++; break; @@ -451,7 +451,7 @@ } } if (!trouble && sd->pscd_ptr != sd->pscd_end - 2) { - printf("%d bytes left after decoder finished.\n\n", + printf("%td bytes left after decoder finished.\n\n", sd->pscd_end - sd->pscd_ptr - 2); trouble++; } Index: b/libjbig/tstcodec85.c =================================================================== --- a/libjbig/tstcodec85.c +++ b/libjbig/tstcodec85.c @@ -334,7 +334,7 @@ for (i = 0; i < 16 * 16 && !trouble; i++) { pix = arith_decode(sd, (t82cx[i >> 4] >> ((15 - i) & 15)) & 1); if (pix < 0) { - printf("Problem at pixel %ld, byte %d.\n\n", + printf("Problem at pixel %ld, byte %td.\n\n", i+1, sd->pscd_ptr - sd->pscd_end); trouble++; break; @@ -346,7 +346,7 @@ } } if (!trouble && sd->pscd_ptr != sd->pscd_end - 2) { - printf("%d bytes left after decoder finished.\n\n", + printf("%td bytes left after decoder finished.\n\n", sd->pscd_end - sd->pscd_ptr - 2); trouble++; } @@ -374,7 +374,7 @@ pix = arith_decode(sd, (t82cx[i >> 4] >> ((15 - i) & 15)) & 1); } if (pix < 0) { - printf("Problem at pixel %ld, byte %d.\n\n", + printf("Problem at pixel %ld, byte %td.\n\n", i+1, sd->pscd_ptr - sd->pscd_end); trouble++; break; @@ -386,7 +386,7 @@ } } if (!trouble && sd->pscd_ptr != sd->pscd_end - 2) { - printf("%d bytes left after decoder finished.\n\n", + printf("%td bytes left after decoder finished.\n\n", sd->pscd_end - sd->pscd_ptr - 2); trouble++; } Index: b/pbmtools/jbgtopbm.c =================================================================== --- a/pbmtools/jbgtopbm.c +++ b/pbmtools/jbgtopbm.c @@ -110,7 +110,7 @@ for (i = 0; i < len && i < max; i++) fprintf(f, "%02x ", p[i]); if (len > i) - fprintf(f, "... %d bytes total", len); + fprintf(f, "... %zd bytes total", len); fprintf(f, "\n"); } @@ -134,7 +134,7 @@ /* read BIH */ read_file(&bie, &buflen, &len, fin); if (len < 20) { - fprintf(f, "Error: Input file is %d < 20 bytes long and therefore " + fprintf(f, "Error: Input file is %zd < 20 bytes long and therefore " "does not contain an intact BIE header!\n", len); return; } @@ -188,18 +188,18 @@ == (JBG_DPON | JBG_DPPRIV)) p += 1728; /* skip DPTABLE */ if (p > bie + len) { - fprintf(f, "Error: Input file is %d < 20+1728 bytes long and therefore " + fprintf(f, "Error: Input file is %zd < 20+1728 bytes long and therefore " "does not contain an intact BIE header with DPTABLE!\n", len); return; } while (p != bie + len) { if (p > bie + len - 2) { - fprintf(f, "%06x: Error: single byte 0x%02x left\n", p - bie, *p); + fprintf(f, "%06tx: Error: single byte 0x%02x left\n", p - bie, *p); return; } pnext = jbg_next_pscdms(p, len - (p - bie)); if (p[0] != MARKER_ESC || p[1] == MARKER_STUFF) { - fprintf(f, "%06x: PSCD: ", p - bie); + fprintf(f, "%06tx: PSCD: ", p - bie); fprint_bytes(f, p, pnext ? (size_t) (pnext - p) : len - (p - bie), 60); if (!pnext) { fprintf(f, "Error: PSCD not terminated by SDNORM or SDRST marker\n"); @@ -209,7 +209,7 @@ switch (p[1]) { case MARKER_SDNORM: case MARKER_SDRST: - fprintf(f, "%06x: ESC %s, ending SDE #%lu", p - bie, + fprintf(f, "%06tx: ESC %s, ending SDE #%lu", p - bie, (p[1] == MARKER_SDNORM) ? "SDNORM" : "SDRST", ++sde); if (sde == sdes) fprintf(f, " (final SDE)"); @@ -219,10 +219,10 @@ fprintf(f, "\n"); break; case MARKER_ABORT: - fprintf(f, "%06x: ESC ABORT\n", p - bie); + fprintf(f, "%06tx: ESC ABORT\n", p - bie); break; case MARKER_NEWLEN: - fprintf(f, "%06x: ESC NEWLEN ", p - bie); + fprintf(f, "%06tx: ESC NEWLEN ", p - bie); if (p + 5 < bie + len) { fprintf(f, "YD = %lu\n", yd = (((long) p[2] << 24) | ((long) p[3] << 16) | @@ -242,7 +242,7 @@ fprintf(f, "unexpected EOF\n"); break; case MARKER_ATMOVE: - fprintf(f, "%06x: ESC ATMOVE ", p - bie); + fprintf(f, "%06tx: ESC ATMOVE ", p - bie); if (p + 7 < bie + len) fprintf(f, "YAT = %lu, tX = %d, tY = %d\n", (((long) p[2] << 24) | ((long) p[3] << 16) | @@ -251,7 +251,7 @@ fprintf(f, "unexpected EOF\n"); break; case MARKER_COMMENT: - fprintf(f, "%06x: ESC COMMENT ", p - bie); + fprintf(f, "%06tx: ESC COMMENT ", p - bie); if (p + 5 < bie + len) fprintf(f, "LC = %lu\n", (((long) p[2] << 24) | ((long) p[3] << 16) | @@ -260,7 +260,7 @@ fprintf(f, "unexpected EOF\n"); break; default: - fprintf(f, "%06x: ESC 0x%02x\n", p - bie, p[1]); + fprintf(f, "%06tx: ESC 0x%02x\n", p - bie, p[1]); } if (!pnext) { fprintf(f, "Error encountered!\n"); @@ -372,7 +372,7 @@ /* read BIH first to check VLENGTH */ len = fread(buffer, 1, 20, fin); if (len < 20) { - fprintf(stderr, "Input file '%s' (%d bytes) must be at least " + fprintf(stderr, "Input file '%s' (%zd bytes) must be at least " "20 bytes long\n", fnin, len); if (fout != stdout) { fclose(fout); Index: b/pbmtools/pbmtojbg.c =================================================================== --- a/pbmtools/pbmtojbg.c +++ b/pbmtools/pbmtojbg.c @@ -88,7 +88,11 @@ while ((c = getc(f)) != EOF && !(c == 13 || c == 10)) ; if (c != EOF) { ungetc(c, f); - fscanf(f, "%lu", &i); + if (fscanf(f, "%lu", &i) != 1) { + /* should never fail, since c must be a digit */ + fprintf(stderr, "Unexpected failure reading digit '%c'\n", c); + exit(1); + } } return i; @@ -302,7 +306,9 @@ break; case '4': /* PBM raw binary format */ - fread(bitmap[0], bitmap_size, 1, fin); + if (fread(bitmap[0], bitmap_size, 1, fin) != 1) { + /* silence compiler warnings; ferror/feof checked below */ + } break; case '2': case '5': @@ -314,8 +320,18 @@ for (j = 0; j < bpp; j++) image[x * bpp + (bpp - 1) - j] = v >> (j * 8); } - } else - fread(image, width * height, bpp, fin); + } else { + if (fread(image, width * height, bpp, fin) != (size_t) bpp) { + if (ferror(fin)) { + fprintf(stderr, "Problem while reading input file '%s", fnin); + perror("'"); + exit(1); + } else { + fprintf(stderr, "Unexpected end of input file '%s'!\n", fnin); + exit(1); + } + } + } jbg_split_planes(width, height, planes, encode_planes, image, bitmap, use_graycode); free(image); Index: b/pbmtools/pbmtojbg85.c =================================================================== --- a/pbmtools/pbmtojbg85.c +++ b/pbmtools/pbmtojbg85.c @@ -72,7 +72,11 @@ while ((c = getc(f)) != EOF && !(c == 13 || c == 10)) ; if (c != EOF) { ungetc(c, f); - fscanf(f, "%lu", &i); + if (fscanf(f, "%lu", &i) != 1) { + /* should never fail, since c must be a digit */ + fprintf(stderr, "Unexpected failure reading digit '%c'\n", c); + exit(1); + } } return i; @@ -239,7 +243,9 @@ break; case '4': /* PBM raw binary format */ - fread(next_line, bpl, 1, fin); + if (fread(next_line, bpl, 1, fin) != 1) { + /* silence compiler warnings; ferror/feof checked below */ + } break; default: fprintf(stderr, "Unsupported PBM type P%c!\n", type); debian/patches/manfiles.diff0000664000000000000000000000664311740525356013270 0ustar Subject: Add missing manpages Author: Michael van der Kolff Forwarded: no Just some help2man manpages. Not worth bothering upstream with, since they're total crap. --- /dev/null +++ b/pbmtools/jbgtopbm85.1 @@ -0,0 +1,49 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4. +.TH JBIGTOPBM "1" "April 2012" "JBIGtoPBM converter 2.0 (T.85 version) --" "User Commands" +.SH NAME +JBIGtoPBM \- manual page for JBIGtoPBM converter 2.0 (T.85 version) -- +.SH DESCRIPTION +JBIGtoPBM converter 2.0 (T.85 version) \fB\-\-\fR +reads a bi\-level image entity (BIE) as input file +.PP +usage: /usr/bin/jbgtopbm85 [ | \- []] +.PP +options: +.TP +\fB\-x\fR number +maximum number of pixels per line for which memory +is allocated (default: 8192) +.TP +\fB\-y\fR number +interrupt decoder after this number of lines +.TP +\fB\-B\fR number +input buffer size +.PP +reads a bi\-level image entity (BIE) as input file +.PP +usage: /usr/bin/jbgtopbm85 [ | \- []] +.PP +options: +.TP +\fB\-x\fR number +maximum number of pixels per line for which memory +is allocated (default: 8192) +.TP +\fB\-y\fR number +interrupt decoder after this number of lines +.TP +\fB\-B\fR number +input buffer size +.SH "SEE ALSO" +The full documentation for +.B JBIGtoPBM +is maintained as a Texinfo manual. If the +.B info +and +.B JBIGtoPBM +programs are properly installed at your site, the command +.IP +.B info JBIGtoPBM +.PP +should give you access to the complete manual. --- /dev/null +++ b/pbmtools/pbmtojbg85.1 @@ -0,0 +1,65 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4. +.TH PBMTOJBIG "1" "April 2012" "PBMtoJBIG converter 2.0 (T.85 version) --" "User Commands" +.SH NAME +PBMtoJBIG \- manual page for PBMtoJBIG converter 2.0 (T.85 version) -- +.SH DESCRIPTION +PBMtoJBIG converter 2.0 (T.85 version) \fB\-\-\fR +creates bi\-level image entity (BIE) as output file +.PP +usage: /usr/bin/pbmtojbg85 [] [ | \- []] +.PP +options: +.TP +\fB\-s\fR number +height of a stripe +.TP +\fB\-m\fR number +maximum adaptive template pixel horizontal offset (default 8) +.TP +\fB\-p\fR number +options byte value: add TPBON=8, LRLTWO=64 +(default 8 = TPBON) +.TP +\fB\-C\fR string +add the provided string as a comment marker segment +.TP +\fB\-Y\fR yi yr +announce in header initially the larger image height yi +and then announce after line yr has been encoded the real height +using NEWLEN marker (for testing NEWLEN and VLENGTH=1 function) +.PP +creates bi\-level image entity (BIE) as output file +.PP +usage: /usr/bin/pbmtojbg85 [] [ | \- []] +.PP +options: +.TP +\fB\-s\fR number +height of a stripe +.TP +\fB\-m\fR number +maximum adaptive template pixel horizontal offset (default 8) +.TP +\fB\-p\fR number +options byte value: add TPBON=8, LRLTWO=64 +(default 8 = TPBON) +.TP +\fB\-C\fR string +add the provided string as a comment marker segment +.TP +\fB\-Y\fR yi yr +announce in header initially the larger image height yi +and then announce after line yr has been encoded the real height +using NEWLEN marker (for testing NEWLEN and VLENGTH=1 function) +.SH "SEE ALSO" +The full documentation for +.B PBMtoJBIG +is maintained as a Texinfo manual. If the +.B info +and +.B PBMtoJBIG +programs are properly installed at your site, the command +.IP +.B info PBMtoJBIG +.PP +should give you access to the complete manual. debian/patches/series0000664000000000000000000000011412250657706012042 0ustar allNewMainMakefile.diff pbmtoolsMakefile.diff shared-lib.diff warnings.diff debian/patches/pbmtoolsMakefile.diff0000664000000000000000000000420711740525356014761 0ustar Subject: Correct the Makefile for the binaries build Author: Michael van der Kolff Forwarded: no Upstream Makefile is barebones, and doesn't make any shared libraries. This corrects the pbmtools part (jbig <-> pbm tools) so that they use the shared libraries. --- a/pbmtools/Makefile +++ b/pbmtools/Makefile @@ -6,23 +6,25 @@ # Options for the compiler CFLAGS = -g -Wall -ansi -pedantic -I../libjbig # --coverage +export LD_LIBRARY_PATH = ../libjbig/.libs +.PHONY: all test test82 test85 .SUFFIXES: .1 .5 .txt $(SUFFIXES) all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 \ pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig + $(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig/.libs -ljbig jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a - $(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig + $(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig/.libs -ljbig -pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.a - $(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85 +pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig.a + $(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig/.libs -ljbig -jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.a - $(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85 +jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig.a + $(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig/.libs -ljbig jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h @@ -33,10 +35,6 @@ ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h make -C ../libjbig libjbig.a -../libjbig/libjbig85.a: ../libjbig/jbig85.c ../libjbig/jbig85.h \ - ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h - make -C ../libjbig libjbig85.a - test: test82 test85 test82: pbmtojbg jbgtopbm @@ -91,6 +89,8 @@ cmp test-$(IMG).pgm ../examples/$(IMG).pgm test85: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 test-t82.pbm + export LD_LIBRARY_PATH=`pwd`/../libjbig/.libs + echo $(LD_LIBRARY_PATH) make IMG=t82 "OPTIONSP=-p 0" dotest85 make IMG=t82 "OPTIONSP=-p 8" dotest85 make IMG=t82 "OPTIONSP=-p 8 -r" dotest85b