From 115758d8e1a0218c9e22623145da89b92afeab0f Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 8 Apr 2015 16:38:46 +1000 Subject: [PATCH] * update sampler --- src/Makefile | 2 +- src/sampler-test.c | 18 ++++++++++++++---- src/sampler.c | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index 71b45f2..7edae61 100644 --- a/src/Makefile +++ b/src/Makefile @@ -29,7 +29,7 @@ imdb_1to2: imdb_1to2.c gcc $(CFLAGS) $(CPPFLAGS) -o $@ $^ FLAGS=$(shell GraphicsMagickWand-config --cppflags --ldflags --libs) -sampler-test: sampler.c sampler-test.c +sampler-test: sampler.c bitmap.c sampler-test.c gcc $(CFLAGS) $(CPPFLAGS) $(FLAGS) -o $@ $^ clean: diff --git a/src/sampler-test.c b/src/sampler-test.c index 2bd9640..852e861 100644 --- a/src/sampler-test.c +++ b/src/sampler-test.c @@ -1,15 +1,25 @@ #include "common.h" #include "database.h" +#include "bitmap.h" #include "sampler.h" int main(int argc, char **argv) { - char * const source = "sample.png"; imdb_rec_t rec; - int ret = 0; + + if (argc < 2) { + puts("Usage: sampler-test "); + exit(EXIT_FAILURE); + } memset(&rec, 0x0, sizeof(imdb_rec_t)); - ret = imdb_sample(&rec, source); - exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE); + if (imdb_sample(&rec, argv[1]) != 0) { + puts("sampler failure"); + exit(EXIT_FAILURE); + } + + bitmap_print(&rec.data[REC_OFF_BM]); + + exit(EXIT_SUCCESS); } diff --git a/src/sampler.c b/src/sampler.c index 4ea95ff..a3b8472 100644 --- a/src/sampler.c +++ b/src/sampler.c @@ -90,7 +90,6 @@ imdb_sample(imdb_rec_t * const rec, fprintf(stderr, "%03d %.1024s\n", severity, description); /* FIXME */ } - DestroyMagickWand(wand); DestroyMagick();