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 f1688be3cd5e34c596afc0027b9c07d2cfec4325 (commit) via 4cc70c909eb0e232bee1263f970d3f2262e34d96 (commit) via 49cc14c142e17b791edbcce2a3b6ad5eef503227 (commit) via 160879734f14a7aa8f676660fdc1bee7a2b256bb (commit) from e13f2d1266a1d8fd179ac4c1b7276dbd831b6436 (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/f1688be3cd5e34c596afc0027b9c07d2cfec4...
commit f1688be3cd5e34c596afc0027b9c07d2cfec4325 Merge: 4cc70c9 e13f2d1 Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 28 11:46:53 2012 +0100
Merge ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/4cc70c909eb0e232bee1263f970d3f2262e34...
commit 4cc70c909eb0e232bee1263f970d3f2262e34d96 Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 28 11:46:01 2012 +0100
spiv: Filter out non image files in dir traversal.
diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c index 1376130..fd35669 100644 --- a/demos/spiv/image_list.c +++ b/demos/spiv/image_list.c @@ -28,6 +28,7 @@ #include <errno.h> #include <string.h>
+#include <loaders/GP_Loader.h> #include <core/GP_Debug.h>
#include "image_list.h" @@ -64,8 +65,10 @@ static int dir_filter(const struct dirent *d) if (!strcmp(d->d_name, "..")) return 0; - //TODO: filter out directories, non-image files? - + //TODO: filter out directories + + if (GP_MatchExtension(d->d_name) == NULL) + return 0;
GP_DEBUG(4, "Adding file '%s'", d->d_name);
http://repo.or.cz/w/gfxprim.git/commit/49cc14c142e17b791edbcce2a3b6ad5eef503...
commit 49cc14c142e17b791edbcce2a3b6ad5eef503227 Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 28 11:43:11 2012 +0100
loaders: Add function to match loader by filename.
diff --git a/build/syms/Loaders_symbols.txt b/build/syms/Loaders_symbols.txt index 2de93ed..bce6650 100644 --- a/build/syms/Loaders_symbols.txt +++ b/build/syms/Loaders_symbols.txt @@ -53,6 +53,7 @@ GP_SaveTmpFile GP_LoadTmpFile
GP_MatchSignature +GP_MatchExtension GP_LoadImage GP_SaveImage GP_LoadMetaData diff --git a/doc/loaders.txt b/doc/loaders.txt index aa16606..907a171 100644 --- a/doc/loaders.txt +++ b/doc/loaders.txt @@ -41,7 +41,7 @@ Image Loader
[source,c] ------------------------------------------------------------------------------- -#include <loaders/GP_Loaders.h> +#include <loaders/GP_Loader.h> /* or */ #include <GP.h>
@@ -66,7 +66,7 @@ stdout.
[source,c] ------------------------------------------------------------------------------- -#include <loaders/GP_Loaders.h> +#include <loaders/GP_Loader.h> /* or */ #include <GP.h>
@@ -164,7 +164,7 @@ link:example_loader_registration.html[example].
[source,c] ------------------------------------------------------------------------------- -#include <loaders/GP_Loaders.h> +#include <loaders/GP_Loader.h> /* or */ #include <GP.h>
@@ -175,6 +175,19 @@ Returns pointer to image loader accordingly to image signature or 'NULL' if no suitable loader was found. The buf pointer must point to a buffer at least 32 bytes long.
+[source,c] +------------------------------------------------------------------------------- +#include <loaders/GP_Loader.h> +/* or */ +#include <GP.h> + +const GP_Loader *GP_MatchExtension(const char *path) +------------------------------------------------------------------------------- + +Matches loader by the file extension. This function does not check that the +file exists or that it could be opened it only looks at the extension (i.e. +string after the dot) and matches it agains known extensions. + WARNING: If you attempt to modify the content of the strucutre the behavior is undefined. Most likely the program will crash.
diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h index 6730613..f80cf58 100644 --- a/include/loaders/GP_Loader.h +++ b/include/loaders/GP_Loader.h @@ -108,6 +108,11 @@ typedef struct GP_Loader { */ const GP_Loader *GP_MatchSignature(const void *buf);
+/* + * Tries to match loader by extension. Returns NULL if no loader was found. + */ +const GP_Loader *GP_MatchExtension(const char *path); + void GP_LoaderRegister(GP_Loader *self);
void GP_LoaderUnregister(GP_Loader *self); diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c index 1d15ec7..fdd2641 100644 --- a/libs/loaders/GP_Loader.c +++ b/libs/loaders/GP_Loader.c @@ -248,7 +248,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
ext_load = loader_by_filename(src_path);
- if (ext_load != NULL) { + if (ext_load != NULL && ext_load->Load != NULL) { img = ext_load->Load(src_path, callback); if (img) @@ -259,7 +259,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) * Avoid further work if signature was correct but the loader issued * ENOSYS. */ - if (errno == ENOSYS) + if (ext_load != NULL && errno == ENOSYS) return NULL;
sig_load = loader_by_signature(src_path); @@ -269,7 +269,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) src_path, ext_load->fmt_name, sig_load->fmt_name); }
- if (sig_load) + if (sig_load && sig_load->Load != NULL) return sig_load->Load(src_path, callback);
errno = ENOSYS; @@ -445,3 +445,8 @@ const GP_Loader *GP_MatchSignature(const void *buf)
return NULL; } + +const GP_Loader *GP_MatchExtension(const char *path) +{ + return loader_by_filename(path); +}
http://repo.or.cz/w/gfxprim.git/commit/160879734f14a7aa8f676660fdc1bee7a2b25...
commit 160879734f14a7aa8f676660fdc1bee7a2b256bb Author: Cyril Hrubis metan@ucw.cz Date: Thu Dec 27 11:45:47 2012 +0100
doc: Add more text formatting.
diff --git a/doc/api.txt b/doc/api.txt index a03d282..7d4898a 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -70,6 +70,8 @@ GFXprim API Video grabbers interface such as V4L2. +
+TIP: There is also a nice page with code link:examples.html[examples]. + GFXprim Internals -----------------
@@ -78,5 +80,3 @@ GFXprim Internals Describes structure and basic usage of the templating engine (C code generator). + - -There is also a nice page with code link:examples.html[examples]. diff --git a/doc/backends.txt b/doc/backends.txt index 5ee7e78..a4fb226 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -9,7 +9,7 @@ controlling the drawing.
So far there are backends for Linux mmaped frame-buffer, libSDL and X11.
-For example usage see backend link:example_backend.html[example]. +TIP: For example usage see backend link:example_backend.html[example].
Initialization functions ------------------------ diff --git a/doc/core.txt b/doc/core.txt index 3e20ee2..a59938d 100644 --- a/doc/core.txt +++ b/doc/core.txt @@ -86,7 +86,7 @@ bitmap loaders 'errno' is set to 'ECANCELED'.
The callback, if supported, is the last parameter of a function.
-For example usage see progress callback +TIP: For example usage see progress callback link:example_loaders_progress_callback.html[example].
Temporary Buffer Allocator diff --git a/doc/grabbers.txt b/doc/grabbers.txt index a794847..ce71654 100644 --- a/doc/grabbers.txt +++ b/doc/grabbers.txt @@ -8,7 +8,7 @@ There is currently V4L2 driver that implements a grabber. To link against grabbers use +-lGP_grabbers+ or better +`gfxprim-config --libs-grabbers`+ in your linker flags.
-For example usage see grabber link:example_v4l2.html[examples]. +TIP: For example usage see grabber link:example_v4l2.html[examples].
Grabber API ~~~~~~~~~~~ diff --git a/doc/input.txt b/doc/input.txt index 35ff473..f48f24d 100644 --- a/doc/input.txt +++ b/doc/input.txt @@ -15,7 +15,7 @@ difference is that events that belongs together are delivered together (the kernel input API sends one event for each value i.e. x or y coordinate and has sync event that finalizes the changes in the values).
-For example usage see input events link:example_input.html[example]. +TIP: For example usage see input events link:example_input.html[example].
Event Structure Description ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/loaders.txt b/doc/loaders.txt index e12c6f8..aa16606 100644 --- a/doc/loaders.txt +++ b/doc/loaders.txt @@ -159,7 +159,7 @@ unregister your own loaders by 'GP_LoaderRegister()' and 'GP_LoaderUnregister()'. Once image loader is registered the generic loading functions could use it to load and save images.
-For example usage see image loader registration +TIP: For example usage see image loader registration link:example_loader_registration.html[example].
[source,c]
-----------------------------------------------------------------------
Summary of changes: build/syms/Loaders_symbols.txt | 1 + demos/spiv/image_list.c | 7 +++++-- doc/api.txt | 4 ++-- doc/backends.txt | 2 +- doc/core.txt | 2 +- doc/grabbers.txt | 2 +- doc/input.txt | 2 +- doc/loaders.txt | 21 +++++++++++++++++---- include/loaders/GP_Loader.h | 5 +++++ libs/loaders/GP_Loader.c | 11 ++++++++--- 10 files changed, 42 insertions(+), 15 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.