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 discards 14a68f948a63033de7c8d8dcf12978edb29b5fa2 (commit) discards 069262b67e2bd246c98f76a4f9ddbbf9bf3c992f (commit) via f41246cb1b727024fe62f46daceefc3e810e330a (commit) via e30b2b00bee284d3e1b7f2055f278e023a950254 (commit)
This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this:
* -- * -- B -- O -- O -- O (14a68f948a63033de7c8d8dcf12978edb29b5fa2) N -- N -- N (f41246cb1b727024fe62f46daceefc3e810e330a)
When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B.
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/f41246cb1b727024fe62f46daceefc3e810e3...
commit f41246cb1b727024fe62f46daceefc3e810e330a Author: Cyril Hrubis metan@ucw.cz Date: Fri Jun 13 11:40:39 2014 +0200
build: Fix Debian build, core should link with -lrt
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/Makefile b/build/Makefile index 3053edfa..5f88872b 100644 --- a/build/Makefile +++ b/build/Makefile @@ -37,10 +37,10 @@ endif
$(DYNAMIC_LIB): $(LIB_OBJECTS) ifdef VERBOSE - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(SONAME) $^ -lm $(LDLIBS_core) -o $@ + $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(SONAME) $^ -lm -lrt $(LDLIBS_core) -o $@ else @echo "LD $@" - @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(SONAME) $^ -lm $(LDLIBS_core) -o $@ + @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(SONAME) $^ -lm -lrt $(LDLIBS_core) -o $@ endif
$(SYMLINKS): $(DYNAMIC_LIB)
http://repo.or.cz/w/gfxprim.git/commit/e30b2b00bee284d3e1b7f2055f278e023a950...
commit e30b2b00bee284d3e1b7f2055f278e023a950254 Author: Cyril Hrubis metan@ucw.cz Date: Fri Jun 13 11:32:22 2014 +0200
loaders: GP_Loader: Get rid of unneeded members
This commit cleanups a few aspects of loaders implementation.
It creates GP_LoaderLoadImage() function that can be used to load image from path for a given loader pointer which allows us to.
* Get rid of the Load() callback from GP_Loader
* Unify GP_LoadFOO implementation
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c index 4b36461a..246394a5 100644 --- a/demos/c_simple/loaders_register.c +++ b/demos/c_simple/loaders_register.c @@ -91,9 +91,7 @@ static int save(const GP_Context *img, const char *dst_path, }
GP_Loader loader = { - .Load = NULL, .Save = save, - .Match = NULL, .fmt_name = "ASCII Art", .extensions = {"txt", NULL}, }; diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h index 3860ac10..6f07d2ea 100644 --- a/include/loaders/GP_Loader.h +++ b/include/loaders/GP_Loader.h @@ -85,13 +85,6 @@ typedef struct GP_Loader { GP_Context *(*Read)(GP_IO *io, GP_ProgressCallback *callback);
/* - * Loads an image from a file. - * - * TODO: Remove due to Read - */ - GP_Context *(*Load)(const char *src_path, GP_ProgressCallback *callback); - - /* * Save an image. * * Returns zero on succes, non-zero on failure and errno must be set. @@ -109,9 +102,6 @@ typedef struct GP_Loader { */ const char *fmt_name;
- /* don't touch */ - struct GP_Loader *next; - /* * NULL terminated array of file extensions. */ @@ -146,6 +136,15 @@ int GP_LoaderRegister(GP_Loader *self); void GP_LoaderUnregister(GP_Loader *self);
/* + * Generic LoadImage for a given loader. + * + * The function prepares the IO from file, calls the loader Read() method, + * closes the IO and returns the context. + */ +GP_Context *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path, + GP_ProgressCallback *callback); + +/* * List loaders into the stdout */ void GP_ListLoaders(void); diff --git a/libs/loaders/GP_BMP.c b/libs/loaders/GP_BMP.c index 9fcff422..4313e2de 100644 --- a/libs/loaders/GP_BMP.c +++ b/libs/loaders/GP_BMP.c @@ -703,21 +703,7 @@ err1:
GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback) { - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadBMP(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; + return GP_LoaderLoadImage(&GP_BMP, src_path, callback); }
/* @@ -908,7 +894,6 @@ int GP_SaveBMP(const GP_Context *src, const char *dst_path,
struct GP_Loader GP_BMP = { .Read = GP_ReadBMP, - .Load = GP_LoadBMP, .Save = GP_SaveBMP, .Match = GP_MatchBMP,
diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c index 6425d60a..a4f3afc0 100644 --- a/libs/loaders/GP_GIF.c +++ b/libs/loaders/GP_GIF.c @@ -358,25 +358,6 @@ err1: return NULL; }
-GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadGIF(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - #else
int GP_MatchGIF(const void GP_UNUSED(*buf)) @@ -392,20 +373,19 @@ GP_Context *GP_ReadGIF(GP_IO GP_UNUSED(*io), return NULL; }
-GP_Context *GP_LoadGIF(const char GP_UNUSED(*src_path), - GP_ProgressCallback GP_UNUSED(*callback)) +#endif /* HAVE_GIFLIB */ + +GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback) { - errno = ENOSYS; - return NULL; + return GP_LoaderLoadImage(&GP_GIF, src_path, callback); }
-#endif /* HAVE_GIFLIB */ - struct GP_Loader GP_GIF = { +#ifdef HAVE_GIFLIB .Read = GP_ReadGIF, - .Load = GP_LoadGIF, - .Save = NULL, +#endif .Match = GP_MatchGIF, + .fmt_name = "Graphics Interchange Format", .extensions = {"gif", NULL}, }; diff --git a/libs/loaders/GP_JP2.c b/libs/loaders/GP_JP2.c index f451b6f1..941849b2 100644 --- a/libs/loaders/GP_JP2.c +++ b/libs/loaders/GP_JP2.c @@ -225,25 +225,6 @@ err0: return res; }
-GP_Context *GP_LoadJP2(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadJP2(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - #else
GP_Context *GP_ReadJP2(GP_IO GP_UNUSED(*io), @@ -253,19 +234,17 @@ GP_Context *GP_ReadJP2(GP_IO GP_UNUSED(*io), return NULL; }
-GP_Context *GP_LoadJP2(const char GP_UNUSED(*src_path), - GP_ProgressCallback GP_UNUSED(*callback)) +#endif /* HAVE_OPENJPEG */ + +GP_Context *GP_LoadJP2(const char *src_path, GP_ProgressCallback *callback) { - errno = ENOSYS; - return NULL; + return GP_LoaderLoadImage(&GP_JP2, src_path, callback); }
-#endif /* HAVE_OPENJPEG */ - struct GP_Loader GP_JP2 = { +#ifdef HAVE_OPENJPEG .Read = GP_ReadJP2, - .Load = GP_LoadJP2, - .Save = NULL, +#endif .Match = GP_MatchJP2,
.fmt_name = "JPEG 2000", diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c index ca14b180..ea891712 100644 --- a/libs/loaders/GP_JPG.c +++ b/libs/loaders/GP_JPG.c @@ -290,25 +290,6 @@ err1: return NULL; }
-GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadJPG(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - #define JPEG_COM_MAX 128
static void read_jpg_metadata(struct jpeg_decompress_struct *cinfo, @@ -564,13 +545,6 @@ GP_Context *GP_ReadJPG(GP_IO GP_UNUSED(*io), return NULL; }
-GP_Context *GP_LoadJPG(const char GP_UNUSED(*src_path), - GP_ProgressCallback GP_UNUSED(*callback)) -{ - errno = ENOSYS; - return NULL; -} - int GP_ReadJPGMetaData(GP_IO GP_UNUSED(*io), GP_MetaData GP_UNUSED(*data)) { errno = ENOSYS; @@ -594,10 +568,16 @@ int GP_SaveJPG(const GP_Context GP_UNUSED(*src),
#endif /* HAVE_JPEG */
+GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_JPG, src_path, callback); +} + struct GP_Loader GP_JPG = { +#ifdef HAVE_JPEG .Read = GP_ReadJPG, - .Load = GP_LoadJPG, .Save = GP_SaveJPG, +#endif .Match = GP_MatchJPG,
.fmt_name = "JPEG", diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c index c3b74feb..763e819b 100644 --- a/libs/loaders/GP_Loader.c +++ b/libs/loaders/GP_Loader.c @@ -126,7 +126,6 @@ void GP_ListLoaders(void) for (i = 0; loaders[i]; i++) { printf("Format: %sn", loaders[i]->fmt_name); printf("Read:t%sn", loaders[i]->Read ? "Yes" : "No"); - printf("Load:t%sn", loaders[i]->Load ? "Yes" : "No"); printf("Save:t%sn", loaders[i]->Save ? "Yes" : "No"); printf("Match:t%sn", loaders[i]->Match ? "Yes" : "No"); printf("Extensions: "); @@ -268,6 +267,31 @@ GP_Context *GP_ReadImage(GP_IO *io, GP_ProgressCallback *callback) return loader->Read(io, callback); }
+GP_Context *GP_LoaderLoadImage(const GP_Loader *self, const char *src_path, + GP_ProgressCallback *callback) +{ + GP_IO *io; + GP_Context *res; + int err; + + if (!self->Read) { + errno = ENOSYS; + return NULL; + } + + io = GP_IOFile(src_path, GP_IO_RDONLY); + if (!io) + return NULL; + + res = self->Read(io, callback); + + err = errno; + GP_IOClose(io); + errno = err; + + return res; +} + GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) { int err; @@ -295,8 +319,8 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
ext_load = loader_by_filename(src_path);
- if (ext_load != NULL && ext_load->Load != NULL) { - img = ext_load->Load(src_path, callback); + if (ext_load) { + img = GP_LoaderLoadImage(ext_load, src_path, callback);
if (img) return img; @@ -316,8 +340,8 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) src_path, ext_load->fmt_name, sig_load->fmt_name); }
- if (sig_load && sig_load->Load != NULL) - return sig_load->Load(src_path, callback); + if (sig_load) + return GP_LoaderLoadImage(sig_load, src_path, callback);
errno = ENOSYS; return NULL; diff --git a/libs/loaders/GP_PCX.c b/libs/loaders/GP_PCX.c index b04dc41b..330b0a7f 100644 --- a/libs/loaders/GP_PCX.c +++ b/libs/loaders/GP_PCX.c @@ -549,27 +549,11 @@ err0:
GP_Context *GP_LoadPCX(const char *src_path, GP_ProgressCallback *callback) { - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPCX(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; + return GP_LoaderLoadImage(&GP_PCX, src_path, callback); }
struct GP_Loader GP_PCX = { .Read = GP_ReadPCX, - .Load = GP_LoadPCX, - .Save = NULL, .Match = GP_MatchPCX,
.fmt_name = "ZSoft PCX", diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c index 2da8bcef..1a73c9a8 100644 --- a/libs/loaders/GP_PNG.c +++ b/libs/loaders/GP_PNG.c @@ -264,25 +264,6 @@ err1: return NULL; }
-GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPNG(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - static void load_meta_data(png_structp png, png_infop png_info, GP_MetaData *data) { double gamma; @@ -625,13 +606,6 @@ GP_Context *GP_ReadPNG(GP_IO GP_UNUSED(*io), return NULL; }
-GP_Context *GP_LoadPNG(const char GP_UNUSED(*src_path), - GP_ProgressCallback GP_UNUSED(*callback)) -{ - errno = ENOSYS; - return NULL; -} - int GP_ReadPNGMetaData(GP_IO GP_UNUSED(*io), GP_MetaData GP_UNUSED(*data)) { errno = ENOSYS; @@ -654,10 +628,16 @@ int GP_SavePNG(const GP_Context GP_UNUSED(*src),
#endif /* HAVE_LIBPNG */
+GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_PNG, src_path, callback); +} + GP_Loader GP_PNG = { +#ifdef HAVE_LIBPNG .Read = GP_ReadPNG, - .Load = GP_LoadPNG, .Save = GP_SavePNG, +#endif .Match = GP_MatchPNG,
.fmt_name = "Portable Network Graphics", diff --git a/libs/loaders/GP_PNM.c b/libs/loaders/GP_PNM.c index 63bb5361..93bc1b68 100644 --- a/libs/loaders/GP_PNM.c +++ b/libs/loaders/GP_PNM.c @@ -712,25 +712,6 @@ GP_Context *GP_ReadPBM(GP_IO *io, GP_ProgressCallback *callback) return read_bitmap(&buf, &header, callback); }
-GP_Context *GP_LoadPBM(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPBM(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - int GP_SavePBM(const GP_Context *src, const char *dst_path, GP_ProgressCallback *callback) { @@ -882,25 +863,6 @@ GP_Context *GP_ReadPGM(GP_IO *io, GP_ProgressCallback *callback) return read_graymap(&buf, &header, callback); }
-GP_Context *GP_LoadPGM(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPGM(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - static int pixel_to_depth(GP_Pixel pixel) { switch (pixel) { @@ -1026,25 +988,6 @@ GP_Context *GP_ReadPPM(GP_IO *io, GP_ProgressCallback *callback) return read_pixmap(&buf, &header, callback); }
-GP_Context *GP_LoadPPM(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPPM(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - static int write_binary_ppm(FILE *f, GP_Context *src) { uint32_t x, y; @@ -1188,25 +1131,6 @@ GP_Context *GP_ReadPNM(GP_IO *io, GP_ProgressCallback *callback) return ret; }
-GP_Context *GP_LoadPNM(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPNM(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - int GP_SavePNM(const GP_Context *src, const char *dst_path, GP_ProgressCallback *callback) { @@ -1227,9 +1151,28 @@ int GP_SavePNM(const GP_Context *src, const char *dst_path, } }
+GP_Context *GP_LoadPBM(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_PBM, src_path, callback); +} + +GP_Context *GP_LoadPGM(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_PGM, src_path, callback); +} + +GP_Context *GP_LoadPPM(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_PPM, src_path, callback); +} + +GP_Context *GP_LoadPNM(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_PNM, src_path, callback); +} + struct GP_Loader GP_PBM = { .Read = GP_ReadPBM, - .Load = GP_LoadPBM, .Save = GP_SavePBM, .Match = GP_MatchPBM,
@@ -1239,7 +1182,6 @@ struct GP_Loader GP_PBM = {
struct GP_Loader GP_PGM = { .Read = GP_ReadPGM, - .Load = GP_LoadPGM, .Save = GP_SavePGM, .Match = GP_MatchPGM,
@@ -1249,7 +1191,6 @@ struct GP_Loader GP_PGM = {
struct GP_Loader GP_PPM = { .Read = GP_ReadPPM, - .Load = GP_LoadPPM, .Save = GP_SavePPM, .Match = GP_MatchPPM,
@@ -1259,7 +1200,6 @@ struct GP_Loader GP_PPM = {
struct GP_Loader GP_PNM = { .Read = GP_ReadPNM, - .Load = GP_LoadPNM, .Save = GP_SavePNM, /* * Avoid double Match diff --git a/libs/loaders/GP_PSD.c b/libs/loaders/GP_PSD.c index 5ef73f11..ba86cb4e 100644 --- a/libs/loaders/GP_PSD.c +++ b/libs/loaders/GP_PSD.c @@ -813,27 +813,11 @@ err:
GP_Context *GP_LoadPSD(const char *src_path, GP_ProgressCallback *callback) { - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPSD(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; + return GP_LoaderLoadImage(&GP_PSD, src_path, callback); }
struct GP_Loader GP_PSD = { .Read = GP_ReadPSD, - .Load = GP_LoadPSD, - .Save = NULL, .Match = GP_MatchPSD,
.fmt_name = "Adobe Photoshop Image", diff --git a/libs/loaders/GP_PSP.c b/libs/loaders/GP_PSP.c index bacd4b9b..64cdeaa6 100644 --- a/libs/loaders/GP_PSP.c +++ b/libs/loaders/GP_PSP.c @@ -491,27 +491,11 @@ err0:
GP_Context *GP_LoadPSP(const char *src_path, GP_ProgressCallback *callback) { - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadPSP(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; + return GP_LoaderLoadImage(&GP_PSP, src_path, callback); }
struct GP_Loader GP_PSP = { .Read = GP_ReadPSP, - .Load = GP_LoadPSP, - .Save = NULL, .Match = GP_MatchPSP, .fmt_name = "Paint Shop Pro Image", .extensions = {"psp", "pspimage", NULL}, diff --git a/libs/loaders/GP_TIFF.c b/libs/loaders/GP_TIFF.c index 1ea06554..bcc23b21 100644 --- a/libs/loaders/GP_TIFF.c +++ b/libs/loaders/GP_TIFF.c @@ -536,25 +536,6 @@ err0: return NULL; }
-GP_Context *GP_LoadTIFF(const char *src_path, GP_ProgressCallback *callback) -{ - GP_IO *io; - GP_Context *res; - int err; - - io = GP_IOFile(src_path, GP_IO_RDONLY); - if (!io) - return NULL; - - res = GP_ReadTIFF(io, callback); - - err = errno; - GP_IOClose(io); - errno = err; - - return res; -} - static int save_grayscale(TIFF *tiff, const GP_Context *src, GP_ProgressCallback *callback) { @@ -746,13 +727,6 @@ GP_Context *GP_ReadTIFF(GP_IO GP_UNUSED(*io), return NULL; }
-GP_Context *GP_LoadTIFF(const char GP_UNUSED(*src_path), - GP_ProgressCallback GP_UNUSED(*callback)) -{ - errno = ENOSYS; - return NULL; -} - int GP_SaveTIFF(const GP_Context GP_UNUSED(*src), const char GP_UNUSED(*dst_path), GP_ProgressCallback GP_UNUSED(*callback)) @@ -763,10 +737,16 @@ int GP_SaveTIFF(const GP_Context GP_UNUSED(*src),
#endif /* HAVE_TIFF */
+GP_Context *GP_LoadTIFF(const char *src_path, GP_ProgressCallback *callback) +{ + return GP_LoaderLoadImage(&GP_TIFF, src_path, callback); +} + struct GP_Loader GP_TIFF = { +#ifdef HAVE_TIFF .Read = GP_ReadTIFF, - .Load = GP_LoadTIFF, .Save = GP_SaveTIFF, +#endif .Match = GP_MatchTIFF,
.fmt_name = "Tag Image File Format",
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/loaders_register.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
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.