This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 2600399e7b0b62f90f89278758e619402535d74d (commit) via 240ca18152614d80a0709a7e41d64eed47c65379 (commit) via 8af66ccd14cac2c8a95560762f40508fc2a7ccf7 (commit) via 68e27f7a81d3c0e89c04b8857edcb6189027f0d1 (commit) via bd1b371f5447999c61281bc1bdf654ae42bfe05e (commit) from 757febd5664bc013d3568d5faec50e4f8de74de8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/2600399e7b0b62f90f89278758e619402535d...
commit 2600399e7b0b62f90f89278758e619402535d74d Author: Cyril Hrubis metan@ucw.cz Date: Thu Nov 28 23:13:50 2013 +0100
build: Fix configure && install.
Make correct use of --prefix and DESTDIR.
Reported-by: Milan Vancura milan@ucw.cz Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/configure b/configure index 2e8164b..ac35338 100755 --- a/configure +++ b/configure @@ -116,7 +116,7 @@ class libraries: sys.stderr.write("----------------------n")
for i in cfg: - sys.stderr.write("%14s : %sn" % (i, cfg[i][0])) + sys.stderr.write("%14s : '%s'n" % (i, cfg[i][0])) sys.stderr.write(" - %snn" % cfg[i][1])
sys.stderr.write("Libraries to link againstn") @@ -227,10 +227,10 @@ def basic_checks(cfg): if cfg['libdir'][0] == '': sys.stderr.write("Checking for lib directory ... ")
- if os.path.isdir(cfg['prefix'][0] + '/usr/lib64'): - cfg['libdir'][0] = '/usr/lib64' + if os.path.isdir('/usr/lib64'): + cfg['libdir'][0] = 'lib64' else: - cfg['libdir'][0] = '/usr/lib' + cfg['libdir'][0] = 'lib'
sys.stderr.write(cfg['libdir'][0] + 'n');
@@ -308,12 +308,12 @@ if __name__ == '__main__': 'SWIG' : ['swig', 'Simplified Wrapper and Interface Generator'], 'PYTHON_CONFIG' : ['python-config', 'Python config helper'], 'PYTHON_VER' : ['', 'Python version (derived from python config)'], - 'include_path' : ['/usr/include', 'Path to the system headers'], - 'prefix' : ['', 'Installation prefix'], - 'bindir' : ['/usr/bin', 'Where to install binaries'], - 'libdir' : ['', 'Where to install libraries'], - 'includedir' : ['/usr/include', 'Where to install headers'], - 'mandir' : ['/usr/share/man', 'Where to install man pages']} + 'include_path' : ['/usr/include', 'Path to the system headers'], + 'prefix' : ['/usr/local/', 'Installation prefix'], + 'bindir' : ['bin', 'Where to install binaries'], + 'libdir' : ['', 'Where to install libraries'], + 'includedir' : ['include', 'Where to install headers'], + 'mandir' : ['share/man', 'Where to install man pages']}
# # Library detection/enable disable @@ -333,36 +333,36 @@ if __name__ == '__main__': "An open-source JPEG 2000 library", [header_exists, "openjpeg-2.0/openjpeg.h"], "", "-lopenjp2", ["loaders"]], ["giflib", - "Library to handle, display and manipulate GIF images", - [header_exists, "gif_lib.h"], "", "-lgif", ["loaders"]], + "Library to handle, display and manipulate GIF images", + [header_exists, "gif_lib.h"], "", "-lgif", ["loaders"]], ["tiff", - "Tag Image File Format (TIFF) library", - [header_exists, "tiffio.h"], "", "-ltiff", ["loaders"]], + "Tag Image File Format (TIFF) library", + [header_exists, "tiffio.h"], "", "-ltiff", ["loaders"]], ["zlib", - "Standard (de)compression library", - [header_exists, "zlib.h"], "", "-lz", ["loaders"]], - ["libX11", - "X11 library", - [header_exists, "X11/Xlib.h"], "", "-lX11", ["backends"]], + "Standard (de)compression library", + [header_exists, "zlib.h"], "", "-lz", ["loaders"]], + ["libX11", + "X11 library", + [header_exists, "X11/Xlib.h"], "", "-lX11", ["backends"]], ["X_SHM", - "MIT-SHM X Extension", - [header_exists, "X11/extensions/XShm.h"], "", "-lXext", ["backends"]], - ["aalib", - "Portable ascii art GFX library", - [header_exists, "aalib.h"], "", "-laa", ["backends"]], - ["freetype", + "MIT-SHM X Extension", + [header_exists, "X11/extensions/XShm.h"], "", "-lXext", ["backends"]], + ["aalib", + "Portable ascii art GFX library", + [header_exists, "aalib.h"], "", "-laa", ["backends"]], + ["freetype", "A high-quality and portable font engine", [header_exists, "ft2build.h"], "", "`freetype-config --libs`", ["core"]], - ["dl", + ["dl", "Dynamic linker", [header_exists, "dlfcn.h"], "", "-ldl", ["core"]], - ["V4L2", + ["V4L2", "Video for linux 2", [header_exists, "linux/videodev2.h"], "", "", ["grabbers"]], - ["pthread", + ["pthread", "Posix Threads", [header_exists, "pthread.h"], "-pthread", "-pthread", ["core"]], - ["backtrace", + ["backtrace", "C stack trace writeout", [c_try_compile, "#include <execinfo.h>nint main(void) { backtrace(0, 0); }", "Checking for backtrace() ... "], "", "", ["core"]]], cfg) @@ -398,7 +398,7 @@ if __name__ == '__main__': l.set(i, False);
for i in cfg: - if getattr(options, i): + if getattr(options, i) is not None: cfg[i][0] = getattr(options, i)
basic_checks(cfg); diff --git a/install.mk b/install.mk index 689acda..991247a 100644 --- a/install.mk +++ b/install.mk @@ -1,13 +1,13 @@ ifdef DESTDIR -BIN_DIR=$(DESTDIR)$(bindir) +BIN_DIR=$(DESTDIR)$(prefix)/$(bindir) else -BIN_DIR=$(bindir) +BIN_DIR=$(prefix)/$(bindir) endif
ifdef DESTDIR -MAN_DIR=$(DESTDIR)$(mandir)/man1 +MAN_DIR=$(DESTDIR)$(prefix)/$(mandir)/man1 else -MAN_DIR=$(mandir)/man1 +MAN_DIR=$(prefix)/$(mandir)/man1 endif
install: @@ -18,7 +18,7 @@ ifdef VERBOSE else @install -d "$(BIN_DIR)" @echo "MKDIR $(BIN_DIR)" - @for i in $(INSTALL_BIN); do echo "CP $$i $(MAN_DIR)"; install "$$i" "$(BIN_DIR)"; done + @for i in $(INSTALL_BIN); do echo "CP $$i $(BIN_DIR)"; install "$$i" "$(BIN_DIR)"; done endif endif
diff --git a/install.sh b/install.sh index 14c9835..a0f8d83 100755 --- a/install.sh +++ b/install.sh @@ -5,9 +5,9 @@ LIBDIR="$2" BINDIR="$3" INCLUDEDIR="$4"
-HEADER_LOC="$PREFIX/$INCLUDEDIR" -LIB_LOC="$PREFIX/$LIBDIR" -BIN_LOC="$PREFIX/$BINDIR" +HEADER_LOC="${DESTDIR}$PREFIX/$INCLUDEDIR" +LIB_LOC="${DESTDIR}$PREFIX/$LIBDIR" +BIN_LOC="${DESTDIR}$PREFIX/$BINDIR"
# Headers echo "INSTALL headers ($HEADER_LOC)" @@ -18,13 +18,15 @@ for i in `ls include/`; do install -m 775 -d "${HEADER_LOC}/GP/$i" install -m 664 "include/$i/"*.h "${HEADER_LOC}/GP/$i" else - install -m 664 "include/$i" "${HEADER_LOC}/GP/$i" + if [ "$i" != "Makefile" ]; then + install -m 664 "include/$i" "${HEADER_LOC}/GP/$i" + fi fi done
# Library echo "INSTALL libraries ($LIB_LOC)" -install -m 775 -d "$LIB_LOC" +install -m 775 -d "$LIB_LOC"
for i in build/*.so build/*.so.* build/*.a; do if [ -L "$i" ]; then
http://repo.or.cz/w/gfxprim.git/commit/240ca18152614d80a0709a7e41d64eed47c65...
commit 240ca18152614d80a0709a7e41d64eed47c65379 Author: Cyril Hrubis metan@ucw.cz Date: Thu Nov 28 22:44:39 2013 +0100
loaders: ZIP: Fix loading from mixed content zips
* Fix loading from ZIP files with mixed content (the loader wrongy aborted on unknown stored file due to wrong error propagation)
* Prepare for end-of-archive detection
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c index d8e20b5..c64214e 100644 --- a/libs/loaders/GP_ZIP.c +++ b/libs/loaders/GP_ZIP.c @@ -275,16 +275,37 @@ err0:
static int zip_load_header(FILE *f, struct zip_local_header *header) { - int ret; + int ret, ch; + + ret = GP_FRead(f, "0x50 0x4b");
- //TODO: check for central directory signature -> end of data + if (ret != 2) { + GP_DEBUG(1, "Failed to read header"); + return EIO; + } + + ch = fgetc(f); + + switch (ch) { + /* Central directory -> end of archive */ + case 0x01: + GP_DEBUG(1, "Reached end of the archive"); + return EINVAL; + break; + /* File header */ + case 0x03: + break; + default: + GP_DEBUG(1, "Unexpected header PK%x", ch); + return EIO; + }
- ret = GP_FRead(f, "0x50 0x4b 0x03 0x04 L2 L2 L2 I4 L4 L4 L4 L2 L2", + ret = GP_FRead(f, "0x04 L2 L2 L2 I4 L4 L4 L4 L2 L2", &header->ver, &header->bit_flags, &header->comp_type, &header->crc, &header->comp_size, &header->uncomp_size, &header->fname_len, &header->extf_len);
- if (ret != 13) { + if (ret != 10) { GP_DEBUG(1, "Failed to read header"); return EIO; } @@ -355,12 +376,15 @@ static GP_Context *zip_next_file(FILE *f, GP_ProgressCallback *callback) ret = GP_ReadPNG(f, callback); }
+ fseek(f, cur_off + header.comp_size, SEEK_SET); + goto out; break; case COMPRESS_DEFLATE: - if (read_deflate(f, &header, &fres)) + if (read_deflate(f, &header, &fres)) { + err = errno; goto out; - + }
ret = GP_ReadJPG(fres, callback);
@@ -369,9 +393,6 @@ static GP_Context *zip_next_file(FILE *f, GP_ProgressCallback *callback) ret = GP_ReadPNG(fres, callback); }
- if (!ret) - err = errno; - fclose(fres); goto out; break; @@ -512,7 +533,6 @@ static int load_next_offset(struct zip_priv *priv) int ret; long offset = ftell(priv->f);
- //TODO: End of file! if ((ret = zip_load_header(priv->f, &header))) return ret;
http://repo.or.cz/w/gfxprim.git/commit/8af66ccd14cac2c8a95560762f40508fc2a7c...
commit 8af66ccd14cac2c8a95560762f40508fc2a7ccf7 Author: Cyril Hrubis metan@ucw.cz Date: Thu Nov 28 22:10:47 2013 +0100
tests: loaders: ZIP: Two more testcases.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/loaders/ZIP.c b/tests/loaders/ZIP.c index c7f9e05..35dded8 100644 --- a/tests/loaders/ZIP.c +++ b/tests/loaders/ZIP.c @@ -76,6 +76,43 @@ struct test jpeg_stored = { .path = "jpeg_stored.zip" };
+struct test mixed_content = { + .w = 100, + .h = 100, + .path = "mixed_content.zip" +}; + +/* + * Test ZIP with no images, we expect to get NULL with errno set to zero + */ +static int no_images(const char *path) +{ + GP_Container *zip = GP_OpenZip(path); + GP_Context *img; + int ret = TST_SUCCESS; + + if (!zip) { + tst_msg("Failed to open zip"); + return TST_FAILED; + } + + img = GP_ContainerLoad(zip, NULL); + + if (img) { + tst_msg("Loaded image from zip without images"); + ret = TST_FAILED; + } + + if (errno) { + tst_msg("Get errno %d (%s)", errno, strerror(errno)); + ret = TST_FAILED; + } + + GP_ContainerClose(zip); + + return ret; +} + const struct tst_suite tst_suite = { .suite_name = "ZIP", .tests = { @@ -91,6 +128,18 @@ const struct tst_suite tst_suite = { .data = &jpeg_stored, .flags = TST_TMPDIR | TST_MALLOC_CANARIES},
+ {.name = "Load JPEG is second file in ZIP", + .tst_fn = test_load, + .res_path = "data/zip/valid/mixed_content.zip", + .data = &mixed_content, + .flags = TST_TMPDIR | TST_MALLOC_CANARIES}, + + {.name = "Load ZIP with no images", + .tst_fn = no_images, + .res_path = "data/zip/valid/no_images.zip", + .data = "no_images.zip", + .flags = TST_TMPDIR | TST_MALLOC_CANARIES}, + {.name = NULL}, } }; diff --git a/tests/loaders/data/zip/valid/mixed_content.zip b/tests/loaders/data/zip/valid/mixed_content.zip new file mode 100644 index 0000000..946db63 Binary files /dev/null and b/tests/loaders/data/zip/valid/mixed_content.zip differ diff --git a/tests/loaders/data/zip/valid/no_images.zip b/tests/loaders/data/zip/valid/no_images.zip new file mode 100644 index 0000000..ac5fcfc Binary files /dev/null and b/tests/loaders/data/zip/valid/no_images.zip differ
http://repo.or.cz/w/gfxprim.git/commit/68e27f7a81d3c0e89c04b8857edcb6189027f...
commit 68e27f7a81d3c0e89c04b8857edcb6189027f0d1 Author: Cyril Hrubis metan@ucw.cz Date: Thu Nov 28 20:04:26 2013 +0100
loaders: ZIP: Fix memory leak in deflate decompression
Add forgotten deinitializaiton for the deflate decompression.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c index 794d794..d8e20b5 100644 --- a/libs/loaders/GP_ZIP.c +++ b/libs/loaders/GP_ZIP.c @@ -258,6 +258,9 @@ static int read_deflate(FILE *f, struct zip_local_header *header, FILE **res_f) goto err2; }
+ inflateBackEnd(&strm); + free(window); + rewind(tf); *res_f = tf; return 0;
http://repo.or.cz/w/gfxprim.git/commit/bd1b371f5447999c61281bc1bdf654ae42bfe...
commit bd1b371f5447999c61281bc1bdf654ae42bfe05e Author: Cyril Hrubis metan@ucw.cz Date: Thu Nov 28 20:03:11 2013 +0100
tests: loaders: Add basic test for ZIP container.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/loaders/Makefile b/tests/loaders/Makefile index 66edb90..a592ff9 100644 --- a/tests/loaders/Makefile +++ b/tests/loaders/Makefile @@ -1,10 +1,10 @@ TOPDIR=../.. include $(TOPDIR)/pre.mk
-CSOURCES=loaders_suite.c PNG.c PBM.c PGM.c PPM.c +CSOURCES=loaders_suite.c PNG.c PBM.c PGM.c PPM.c ZIP.c GENSOURCES=SaveLoad.gen.c SaveAbort.gen.c
-APPS=loaders_suite PNG PBM PGM PPM SaveLoad.gen SaveAbort.gen +APPS=loaders_suite PNG PBM PGM PPM SaveLoad.gen SaveAbort.gen ZIP
include ../tests.mk
diff --git a/tests/loaders/ZIP.c b/tests/loaders/ZIP.c new file mode 100644 index 0000000..c7f9e05 --- /dev/null +++ b/tests/loaders/ZIP.c @@ -0,0 +1,96 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim 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 * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> +#include <errno.h> +#include <sys/stat.h> + +#include <core/GP_Context.h> +#include <loaders/GP_Loaders.h> + +#include "tst_test.h" + +struct test { + GP_Size w, h; + const char *path; +}; + +static int test_load(struct test *test) +{ + GP_Container *zip = GP_OpenZip(test->path); + GP_Context *img; + int ret = TST_SUCCESS; + + if (!zip) { + tst_msg("Failed to open zip"); + return TST_FAILED; + } + + img = GP_ContainerLoad(zip, NULL); + + if (!img) { + tst_msg("Failed to load image"); + return TST_FAILED; + } + + if (img->w != test->w || img->h != test->h) { + tst_msg("Image has wrong size, expected %ux%u have %ux%u", + test->w, test->h, img->w, img->h); + ret = TST_FAILED; + } + + GP_ContextFree(img); + GP_ContainerClose(zip); + + return ret; +} + +struct test jpeg_deflated = { + .w = 100, + .h = 100, + .path = "jpeg_deflated.zip" +}; + +struct test jpeg_stored = { + .w = 100, + .h = 100, + .path = "jpeg_stored.zip" +}; + +const struct tst_suite tst_suite = { + .suite_name = "ZIP", + .tests = { + {.name = "Load JPEG deflated in ZIP", + .tst_fn = test_load, + .res_path = "data/zip/valid/jpeg_deflated.zip", + .data = &jpeg_deflated, + .flags = TST_TMPDIR | TST_MALLOC_CANARIES}, + + {.name = "Load JPEG stored in ZIP", + .tst_fn = test_load, + .res_path = "data/zip/valid/jpeg_stored.zip", + .data = &jpeg_stored, + .flags = TST_TMPDIR | TST_MALLOC_CANARIES}, + + {.name = NULL}, + } +}; diff --git a/tests/loaders/data/zip/valid/jpeg_deflated.zip b/tests/loaders/data/zip/valid/jpeg_deflated.zip new file mode 100644 index 0000000..7a84e36 Binary files /dev/null and b/tests/loaders/data/zip/valid/jpeg_deflated.zip differ diff --git a/tests/loaders/data/zip/valid/jpeg_stored.zip b/tests/loaders/data/zip/valid/jpeg_stored.zip new file mode 100644 index 0000000..eceb6c0 Binary files /dev/null and b/tests/loaders/data/zip/valid/jpeg_stored.zip differ diff --git a/tests/loaders/test_list.txt b/tests/loaders/test_list.txt index 162943e..9f52d34 100644 --- a/tests/loaders/test_list.txt +++ b/tests/loaders/test_list.txt @@ -4,5 +4,6 @@ PNG PBM PGM PPM +ZIP SaveLoad.gen SaveAbort.gen
-----------------------------------------------------------------------
Summary of changes: configure | 60 +++++----- install.mk | 10 +- install.sh | 12 +- libs/loaders/GP_ZIP.c | 43 +++++-- tests/loaders/Makefile | 4 +- tests/loaders/{SaveLoad.gen.c.t => ZIP.c} | 161 +++++++++++++----------- tests/loaders/data/zip/valid/jpeg_deflated.zip | Bin 0 -> 384 bytes tests/loaders/data/zip/valid/jpeg_stored.zip | Bin 0 -> 564 bytes tests/loaders/data/zip/valid/mixed_content.zip | Bin 0 -> 549 bytes tests/loaders/data/zip/valid/no_images.zip | Bin 0 -> 363 bytes tests/loaders/test_list.txt | 1 + 11 files changed, 163 insertions(+), 128 deletions(-) copy tests/loaders/{SaveLoad.gen.c.t => ZIP.c} (50%) create mode 100644 tests/loaders/data/zip/valid/jpeg_deflated.zip create mode 100644 tests/loaders/data/zip/valid/jpeg_stored.zip create mode 100644 tests/loaders/data/zip/valid/mixed_content.zip create mode 100644 tests/loaders/data/zip/valid/no_images.zip
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.