Enable having some gdk-pixbuf loaders built-in even if loading the others

2006-10-11  Tor Lillqvist  <tml@novell.com>

	* configure.in: Enable having some gdk-pixbuf loaders built-in
	even if loading the others dynamically. Define Automake
	conditional INCLUDE_FOO for each loader as TRUE if that loader is
	built-in. See also gdk-pixbuf/ChangeLog.

2006-10-11  Tor Lillqvist  <tml@novell.com>

	Enable having some loaders built-in even if loading the others
	dynamically. Have loaders in the same order as in configure.in in
	all places where they are handled/listed.

	* Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros
	conditionally depending on whether said loader is built-in or
	not. Use the names libstatic-pixbufloader-foo.la instead of
	libpixbufloader-static-foo.la for the built-in ones so that the
	"echo libpixbufloader-*.la" won't match them.

	* gdk-pixbuf-io.c: Reorganize code as to plumb the built-in
	loaders also if USE_GMODULE. Don't warn about a missing
	gdk-pixbuf.loaders file if we have at least one included loader.

	* gdk-pixbuf-private.h
	* io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it
	in the loaders anyway. Each loader needs to check if INCLUDE_foo
	is defined.
This commit is contained in:
Tor Lillqvist 2006-10-11 12:41:14 +00:00 committed by Tor Lillqvist
parent f58c280d21
commit f6783c7466
20 changed files with 447 additions and 299 deletions

View File

@ -1,3 +1,10 @@
2006-10-11 Tor Lillqvist <tml@novell.com>
* configure.in: Enable having some gdk-pixbuf loaders built-in
even if loading the others dynamically. Define Automake
conditional INCLUDE_FOO for each loader as TRUE if that loader is
built-in. See also gdk-pixbuf/ChangeLog.
Wed Oct 11 14:31:30 2006 Tim Janik <timj@imendio.com>
* docs/reference/gtk/gtk-sections.txt:

View File

@ -874,11 +874,10 @@ dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
dnl [build the specified loaders into gdk-pixbuf (only used if module loading disabled)])
AC_ARG_WITH(included_loaders,
[ --with-included-loaders=LOADER1,LOADER2,...
build the specified loaders into gdk-pixbuf (only
used if module loading disabled)])
build the specified loaders into gdk-pixbuf])
if $dynworks; then
:
:
else
## if the option was specified, leave it; otherwise disable included loaders
if test x$with_included_loaders = xno; then
@ -886,7 +885,7 @@ else
fi
fi
all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,tga,pcx"
all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,xbm,tga,pcx"
included_loaders=""
# If no loaders specified, include all
if test "x$with_included_loaders" = xyes ; then
@ -908,13 +907,29 @@ for loader in $included_loaders; do
AC_MSG_ERROR([the specified loader $loader does not exist])
fi
INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libpixbufloader-static-$loader.la"
INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
eval INCLUDE_$loader=yes
done
IFS="$gtk_save_ifs"
AC_SUBST(INCLUDED_LOADER_OBJ)
AC_SUBST(INCLUDED_LOADER_DEFINE)
AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
AC_HEADER_SYS_WAIT
AC_TYPE_SIGNAL

View File

@ -1,3 +1,24 @@
2006-10-11 Tor Lillqvist <tml@novell.com>
Enable having some loaders built-in even if loading the others
dynamically. Have loaders in the same order as in configure.in in
all places where they are handled/listed.
* Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros
conditionally depending on whether said loader is built-in or
not. Use the names libstatic-pixbufloader-foo.la instead of
libpixbufloader-static-foo.la for the built-in ones so that the
"echo libpixbufloader-*.la" won't match them.
* gdk-pixbuf-io.c: Reorganize code as to plumb the built-in
loaders also if USE_GMODULE. Don't warn about a missing
gdk-pixbuf.loaders file if we have at least one included loader.
* gdk-pixbuf-private.h
* io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it
in the loaders anyway. Each loader needs to check if INCLUDE_foo
is defined.
2006-10-08 Matthias Clasen <mclasen@redhat.com>
* Apply a cleanup patch by Kjartan Maraas (#341812)

View File

@ -61,81 +61,17 @@ loaderdir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/loaders
module_libs = libgdk_pixbuf-$(GTK_API_VERSION).la $(GDK_PIXBUF_DEP_LIBS)
#
# The PNG plugin.
# The PNG loader
#
libpixbufloader_png_la_SOURCES = io-png.c
libpixbufloader_png_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_png_la_LIBADD = $(LIBPNG) $(module_libs)
libpixbufloader_static_png_la_SOURCES = io-png.c
#
# The JPEG loader
#
libpixbufloader_static_jpeg_la_SOURCES = io-jpeg.c
libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
#
# The XPM loader
#
libpixbufloader_static_xpm_la_SOURCES = io-xpm.c
libpixbufloader_xpm_la_SOURCES = io-xpm.c
libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_xpm_la_LIBADD = $(module_libs)
#
# The GIF loader
#
libpixbufloader_static_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_gif_la_LIBADD = $(module_libs)
#
# The ICO loader
#
libpixbufloader_static_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ico_la_LIBADD = $(module_libs)
#
# The ANI loader
#
libpixbufloader_static_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ani_la_LIBADD = $(module_libs)
#
# The RAS loader
#
libpixbufloader_static_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ras_la_LIBADD = $(module_libs)
#
# The TIFF loader
#
libpixbufloader_static_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_tiff_la_LIBADD = $(LIBTIFF) $(module_libs)
#
# The PNM loader
#
libpixbufloader_static_pnm_la_SOURCES = io-pnm.c
libpixbufloader_pnm_la_SOURCES = io-pnm.c
libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_pnm_la_LIBADD = $(module_libs)
libstatic_pixbufloader_png_la_SOURCES = io-png.c
#
# The BMP loader
#
libpixbufloader_static_bmp_la_SOURCES = io-bmp.c
libstatic_pixbufloader_bmp_la_SOURCES = io-bmp.c
libpixbufloader_bmp_la_SOURCES = io-bmp.c
libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_bmp_la_LIBADD = $(module_libs)
@ -143,15 +79,79 @@ libpixbufloader_bmp_la_LIBADD = $(module_libs)
#
# The WBMP loader
#
libpixbufloader_static_wbmp_la_SOURCES = io-wbmp.c
libstatic_pixbufloader_wbmp_la_SOURCES = io-wbmp.c
libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_wbmp_la_LIBADD = $(module_libs)
#
# The GIF loader
#
libstatic_pixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
libpixbufloader_gif_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_gif_la_LIBADD = $(module_libs)
#
# The ICO loader
#
libstatic_pixbufloader_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_SOURCES = io-ico.c
libpixbufloader_ico_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ico_la_LIBADD = $(module_libs)
#
# The ANI loader
#
libstatic_pixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
libpixbufloader_ani_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ani_la_LIBADD = $(module_libs)
#
# The JPEG loader
#
libstatic_pixbufloader_jpeg_la_SOURCES = io-jpeg.c
libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
#
# The PNM loader
#
libstatic_pixbufloader_pnm_la_SOURCES = io-pnm.c
libpixbufloader_pnm_la_SOURCES = io-pnm.c
libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_pnm_la_LIBADD = $(module_libs)
#
# The RAS loader
#
libstatic_pixbufloader_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_SOURCES = io-ras.c
libpixbufloader_ras_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_ras_la_LIBADD = $(module_libs)
#
# The TIFF loader
#
libstatic_pixbufloader_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_SOURCES = io-tiff.c
libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_tiff_la_LIBADD = $(LIBTIFF) $(module_libs)
#
# The XPM loader
#
libstatic_pixbufloader_xpm_la_SOURCES = io-xpm.c
libpixbufloader_xpm_la_SOURCES = io-xpm.c
libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_xpm_la_LIBADD = $(module_libs)
#
# The XBM loader
#
libpixbufloader_static_xbm_la_SOURCES = io-xbm.c
libstatic_pixbufloader_xbm_la_SOURCES = io-xbm.c
libpixbufloader_xbm_la_SOURCES = io-xbm.c
libpixbufloader_xbm_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_xbm_la_LIBADD = $(module_libs)
@ -159,7 +159,7 @@ libpixbufloader_xbm_la_LIBADD = $(module_libs)
#
# The TGA loader
#
libpixbufloader_static_tga_la_SOURCES = io-tga.c
libstatic_pixbufloader_tga_la_SOURCES = io-tga.c
libpixbufloader_tga_la_SOURCES = io-tga.c
libpixbufloader_tga_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_tga_la_LIBADD = $(module_libs)
@ -167,102 +167,140 @@ libpixbufloader_tga_la_LIBADD = $(module_libs)
#
# The PCX loader
#
libpixbufloader_static_pcx_la_SOURCES = io-pcx.c
libstatic_pixbufloader_pcx_la_SOURCES = io-pcx.c
libpixbufloader_pcx_la_SOURCES = io-pcx.c
libpixbufloader_pcx_la_LDFLAGS = -avoid-version -module $(no_undefined)
libpixbufloader_pcx_la_LIBADD = $(module_libs)
if HAVE_PNG
if INCLUDE_PNG
STATIC_PNG_LIB = libstatic-pixbufloader-png.la
else
PNG_LIB = libpixbufloader-png.la
STATIC_PNG_LIB = libpixbufloader-static-png.la
endif
endif
if INCLUDE_BMP
STATIC_BMP_LIB = libstatic-pixbufloader-bmp.la
else
BMP_LIB = libpixbufloader-bmp.la
endif
if INCLUDE_WBMP
STATIC_WBMP_LIB = libstatic-pixbufloader-wbmp.la
else
WBMP_LIB = libpixbufloader-wbmp.la
endif
if INCLUDE_GIF
STATIC_GIF_LIB = libstatic-pixbufloader-gif.la
else
GIF_LIB = libpixbufloader-gif.la
endif
if INCLUDE_ICO
STATIC_ICO_LIB = libstatic-pixbufloader-ico.la
else
ICO_LIB = libpixbufloader-ico.la
endif
if INCLUDE_ANI
STATIC_ANI_LIB = libstatic-pixbufloader-ani.la
else
ANI_LIB = libpixbufloader-ani.la
endif
if HAVE_JPEG
if INCLUDE_JPEG
STATIC_JPEG_LIB = libstatic-pixbufloader-jpeg.la
else
JPEG_LIB = libpixbufloader-jpeg.la
STATIC_JPEG_LIB = libpixbufloader-static-jpeg.la
endif
endif
GIF_LIB = libpixbufloader-gif.la
STATIC_GIF_LIB = libpixbufloader-static-gif.la
ICO_LIB = libpixbufloader-ico.la
STATIC_ICO_LIB = libpixbufloader-static-ico.la
ANI_LIB = libpixbufloader-ani.la
STATIC_ANI_LIB = libpixbufloader-static-ani.la
if INCLUDE_PNM
STATIC_PNM_LIB = libstatic-pixbufloader-pnm.la
else
PNM_LIB = libpixbufloader-pnm.la
endif
if INCLUDE_RAS
STATIC_RAS_LIB = libstatic-pixbufloader-ras.la
else
RAS_LIB = libpixbufloader-ras.la
STATIC_RAS_LIB = libpixbufloader-static-ras.la
endif
if HAVE_TIFF
if INCLUDE_TIFF
STATIC_TIFF_LIB = libstatic-pixbufloader-tiff.la
else
TIFF_LIB = libpixbufloader-tiff.la
STATIC_TIFF_LIB = libpixbufloader-static-tiff.la
endif
endif
if INCLUDE_XPM
STATIC_XPM_LIB = libstatic-pixbufloader-xpm.la
else
XPM_LIB = libpixbufloader-xpm.la
STATIC_XPM_LIB = libpixbufloader-static-xpm.la
PNM_LIB = libpixbufloader-pnm.la
STATIC_PNM_LIB = libpixbufloader-static-pnm.la
BMP_LIB = libpixbufloader-bmp.la
STATIC_BMP_LIB = libpixbufloader-static-bmp.la
WBMP_LIB = libpixbufloader-wbmp.la
STATIC_WBMP_LIB = libpixbufloader-static-wbmp.la
endif
if INCLUDE_XBM
STATIC_XBM_LIB = libstatic-pixbufloader-xbm.la
else
XBM_LIB = libpixbufloader-xbm.la
STATIC_XBM_LIB = libpixbufloader-static-xbm.la
endif
if INCLUDE_TGA
STATIC_TGA_LIB = libstatic-pixbufloader-tga.la
else
TGA_LIB = libpixbufloader-tga.la
STATIC_TGA_LIB = libpixbufloader-static-tga.la
endif
if INCLUDE_PCX
STATIC_PCX_LIB = libstatic-pixbufloader-pcx.la
else
PCX_LIB = libpixbufloader-pcx.la
STATIC_PCX_LIB = libpixbufloader-static-pcx.la
endif
if BUILD_DYNAMIC_MODULES
loader_LTLIBRARIES = \
$(PNG_LIB) \
$(JPEG_LIB) \
$(BMP_LIB) \
$(WBMP_LIB) \
$(GIF_LIB) \
$(ICO_LIB) \
$(ANI_LIB) \
$(RAS_LIB) \
$(XPM_LIB) \
$(TIFF_LIB) \
$(JPEG_LIB) \
$(PNM_LIB) \
$(BMP_LIB) \
$(WBMP_LIB) \
$(RAS_LIB) \
$(TIFF_LIB) \
$(XPM_LIB) \
$(XBM_LIB) \
$(TGA_LIB) \
$(PCX_LIB)
extra_sources =
builtin_objs =
else
loader_LTLIBRARIES =
endif
noinst_LTLIBRARIES = \
$(STATIC_PNG_LIB) \
$(STATIC_JPEG_LIB) \
$(STATIC_BMP_LIB) \
$(STATIC_WBMP_LIB) \
$(STATIC_GIF_LIB) \
$(STATIC_ICO_LIB) \
$(STATIC_ANI_LIB) \
$(STATIC_RAS_LIB) \
$(STATIC_XPM_LIB) \
$(STATIC_TIFF_LIB) \
$(STATIC_JPEG_LIB) \
$(STATIC_PNM_LIB) \
$(STATIC_BMP_LIB) \
$(STATIC_WBMP_LIB) \
$(STATIC_RAS_LIB) \
$(STATIC_TIFF_LIB) \
$(STATIC_XPM_LIB) \
$(STATIC_XBM_LIB) \
$(STATIC_TGA_LIB) \
$(STATIC_PCX_LIB)
builtin_objs = @INCLUDED_LOADER_OBJ@
endif
DEPS = libgdk_pixbuf-$(GTK_API_VERSION).la
INCLUDES = \

View File

@ -282,9 +282,12 @@ gdk_pixbuf_get_module_file (void)
return result;
}
#endif /* USE_GMODULE */
static void
gdk_pixbuf_io_init (void)
{
#ifdef USE_GMODULE
GIOChannel *channel;
gchar *line_buf;
gsize term;
@ -296,11 +299,69 @@ gdk_pixbuf_io_init (void)
int n_patterns = 0;
GdkPixbufModulePattern *pattern;
GError *error = NULL;
#endif
GdkPixbufModule *builtin_module = NULL;
#define load_one_builtin_module(format) \
builtin_module = g_new0 (GdkPixbufModule, 1); \
builtin_module->module_name = #format; \
if (_gdk_pixbuf_load_module (builtin_module, NULL)) \
file_formats = g_slist_prepend (file_formats, builtin_module);\
else \
g_free (builtin_module)
#ifdef INCLUDE_ani
load_one_builtin_module (ani);
#endif
#ifdef INCLUDE_png
load_one_builtin_module (png);
#endif
#ifdef INCLUDE_bmp
load_one_builtin_module (bmp);
#endif
#ifdef INCLUDE_wbmp
load_one_builtin_module (wbmp);
#endif
#ifdef INCLUDE_gif
load_one_builtin_module (gif);
#endif
#ifdef INCLUDE_ico
load_one_builtin_module (ico);
#endif
#ifdef INCLUDE_jpeg
load_one_builtin_module (jpeg);
#endif
#ifdef INCLUDE_pnm
load_one_builtin_module (pnm);
#endif
#ifdef INCLUDE_ras
load_one_builtin_module (ras);
#endif
#ifdef INCLUDE_tiff
load_one_builtin_module (tiff);
#endif
#ifdef INCLUDE_xpm
load_one_builtin_module (xpm);
#endif
#ifdef INCLUDE_xbm
load_one_builtin_module (xbm);
#endif
#ifdef INCLUDE_tga
load_one_builtin_module (tga);
#endif
#ifdef INCLUDE_pcx
load_one_builtin_module (pcx);
#endif
#undef load_one_builtin_module
#ifdef USE_GMODULE
channel = g_io_channel_new_file (filename, "r", &error);
if (!channel) {
g_warning ("Cannot open pixbuf loader module file '%s': %s",
filename, error->message);
/* Don't bother warning if we have some built-in loaders */
if (file_formats == NULL)
g_warning ("Cannot open pixbuf loader module file '%s': %s",
filename, error->message);
return;
}
@ -438,8 +499,11 @@ gdk_pixbuf_io_init (void)
g_string_free (tmp_buf, TRUE);
g_io_channel_unref (channel);
g_free (filename);
#endif
}
#ifdef USE_GMODULE
/* actually load the image handler - gdk_pixbuf_get_module only get a */
/* reference to the module to load, it doesn't actually load it */
/* perhaps these actions should be combined in one function */
@ -481,12 +545,99 @@ _gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
}
}
#endif /* !USE_GMODULE */
#define module(type) \
extern void _gdk_pixbuf__##type##_fill_info (GdkPixbufFormat *info); \
extern void _gdk_pixbuf__##type##_fill_vtable (GdkPixbufModule *module)
module (png);
module (jpeg);
module (gif);
module (ico);
module (ani);
module (ras);
module (xpm);
module (tiff);
module (pnm);
module (bmp);
module (wbmp);
module (xbm);
module (tga);
module (pcx);
#undef module
gboolean
_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
GError **error)
{
gboolean ret;
gboolean locked = FALSE;
GdkPixbufModuleFillInfoFunc fill_info = NULL;
GdkPixbufModuleFillVtableFunc fill_vtable = NULL;
#define try_module(format) \
if (fill_info == NULL && \
strcmp (image_module->module_name, #format) == 0) { \
fill_info = _gdk_pixbuf__##format##_fill_info; \
fill_vtable = _gdk_pixbuf__##format##_fill_vtable; \
}
#ifdef INCLUDE_png
try_module (png);
#endif
#ifdef INCLUDE_bmp
try_module (bmp);
#endif
#ifdef INCLUDE_wbmp
try_module (wbmp);
#endif
#ifdef INCLUDE_gif
try_module (gif);
#endif
#ifdef INCLUDE_ico
try_module (ico);
#endif
#ifdef INCLUDE_ani
try_module (ani);
#endif
#ifdef INCLUDE_jpeg
try_module (jpeg);
#endif
#ifdef INCLUDE_pnm
try_module (pnm);
#endif
#ifdef INCLUDE_ras
try_module (ras);
#endif
#ifdef INCLUDE_tiff
try_module (tiff);
#endif
#ifdef INCLUDE_xpm
try_module (xpm);
#endif
#ifdef INCLUDE_xbm
try_module (xbm);
#endif
#ifdef INCLUDE_tga
try_module (tga);
#endif
#ifdef INCLUDE_pcx
try_module (pcx);
#endif
#undef try_module
if (fill_vtable) {
image_module->module = (void *) 1;
(* fill_vtable) (image_module);
image_module->info = g_new0 (GdkPixbufFormat, 1);
(* fill_info) (image_module->info);
return TRUE;
}
#ifdef USE_GMODULE
/* be extra careful, maybe the module initializes
* the thread system
@ -500,181 +651,19 @@ _gdk_pixbuf_load_module (GdkPixbufModule *image_module,
if (locked)
G_UNLOCK (init_lock);
return ret;
#else
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("Image type '%s' is not supported"),
image_module->module_name);
return FALSE;
#endif
}
#else /* !USE_GMODULE */
#define module(type) \
extern void MODULE_ENTRY (type, fill_info) (GdkPixbufFormat *info); \
extern void MODULE_ENTRY (type, fill_vtable) (GdkPixbufModule *module)
module (png);
module (bmp);
module (wbmp);
module (gif);
module (ico);
module (ani);
module (jpeg);
module (pnm);
module (ras);
module (tiff);
module (xpm);
module (xbm);
module (tga);
module (pcx);
gboolean
_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
GError **error)
{
GdkPixbufModuleFillInfoFunc fill_info = NULL;
GdkPixbufModuleFillVtableFunc fill_vtable = NULL;
image_module->module = (void *) 1;
if (FALSE) {
/* Ugly hack so we can use else if unconditionally below ;-) */
}
#ifdef INCLUDE_png
else if (strcmp (image_module->module_name, "png") == 0) {
fill_info = MODULE_ENTRY (png, fill_info);
fill_vtable = MODULE_ENTRY (png, fill_vtable);
}
#endif
#ifdef INCLUDE_bmp
else if (strcmp (image_module->module_name, "bmp") == 0) {
fill_info = MODULE_ENTRY (bmp, fill_info);
fill_vtable = MODULE_ENTRY (bmp, fill_vtable);
}
#endif
#ifdef INCLUDE_wbmp
else if (strcmp (image_module->module_name, "wbmp") == 0) {
fill_info = MODULE_ENTRY (wbmp, fill_info);
fill_vtable = MODULE_ENTRY (wbmp, fill_vtable);
}
#endif
#ifdef INCLUDE_gif
else if (strcmp (image_module->module_name, "gif") == 0) {
fill_info = MODULE_ENTRY (gif, fill_info);
fill_vtable = MODULE_ENTRY (gif, fill_vtable);
}
#endif
#ifdef INCLUDE_ico
else if (strcmp (image_module->module_name, "ico") == 0) {
fill_info = MODULE_ENTRY (ico, fill_info);
fill_vtable = MODULE_ENTRY (ico, fill_vtable);
}
#endif
#ifdef INCLUDE_ani
else if (strcmp (image_module->module_name, "ani") == 0) {
fill_info = MODULE_ENTRY (ani, fill_info);
fill_vtable = MODULE_ENTRY (ani, fill_vtable);
}
#endif
#ifdef INCLUDE_jpeg
else if (strcmp (image_module->module_name, "jpeg") == 0) {
fill_info = MODULE_ENTRY (jpeg, fill_info);
fill_vtable = MODULE_ENTRY (jpeg, fill_vtable);
}
#endif
#ifdef INCLUDE_pnm
else if (strcmp (image_module->module_name, "pnm") == 0) {
fill_info = MODULE_ENTRY (pnm, fill_info);
fill_vtable = MODULE_ENTRY (pnm, fill_vtable);
}
#endif
#ifdef INCLUDE_ras
else if (strcmp (image_module->module_name, "ras") == 0) {
fill_info = MODULE_ENTRY (ras, fill_info);
fill_vtable = MODULE_ENTRY (ras, fill_vtable);
}
#endif
#ifdef INCLUDE_tiff
else if (strcmp (image_module->module_name, "tiff") == 0) {
fill_info = MODULE_ENTRY (tiff, fill_info);
fill_vtable = MODULE_ENTRY (tiff, fill_vtable);
}
#endif
#ifdef INCLUDE_xpm
else if (strcmp (image_module->module_name, "xpm") == 0) {
fill_info = MODULE_ENTRY (xpm, fill_info);
fill_vtable = MODULE_ENTRY (xpm, fill_vtable);
}
#endif
#ifdef INCLUDE_xbm
else if (strcmp (image_module->module_name, "xbm") == 0) {
fill_info = MODULE_ENTRY (xbm, fill_info);
fill_vtable = MODULE_ENTRY (xbm, fill_vtable);
}
#endif
#ifdef INCLUDE_tga
else if (strcmp (image_module->module_name, "tga") == 0) {
fill_info = MODULE_ENTRY (tga, fill_info);
fill_vtable = MODULE_ENTRY (tga, fill_vtable);
}
#endif
#ifdef INCLUDE_pcx
else if (strcmp (image_module->module_name, "pcx") == 0) {
fill_info = MODULE_ENTRY (pcx, fill_info);
fill_vtable = MODULE_ENTRY (pcx, fill_vtable);
}
#endif
if (fill_vtable) {
(* fill_vtable) (image_module);
image_module->info = g_new0 (GdkPixbufFormat, 1);
(* fill_info) (image_module->info);
return TRUE;
} else {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("Image type '%s' is not supported"),
image_module->module_name);
return FALSE;
}
}
static void
gdk_pixbuf_io_init ()
{
gchar *included_formats[] = {
"ani", "png", "bmp", "wbmp", "gif",
"ico", "jpeg", "pnm", "ras", "tiff",
"xpm", "xbm", "tga", "pcx",
NULL
};
gchar **name;
GdkPixbufModule *module = NULL;
for (name = included_formats; *name; name++) {
module = g_new0 (GdkPixbufModule, 1);
module->module_name = *name;
if (_gdk_pixbuf_load_module (module, NULL))
file_formats = g_slist_prepend (file_formats, module);
else
g_free (module);
}
}
#endif /* !USE_GMODULE */
GdkPixbufModule *

View File

@ -96,12 +96,6 @@ GdkPixbuf *_gdk_pixbuf_generic_image_load (GdkPixbufModule *image_module,
GdkPixbufFormat *_gdk_pixbuf_get_format (GdkPixbufModule *image_module);
#ifdef USE_GMODULE
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
#endif /* GDK_PIXBUF_ENABLE_BACKEND */
#endif /* GDK_PIXBUF_PRIVATE_H */

View File

@ -644,6 +644,12 @@ gdk_pixbuf__ani_image_load_animation (FILE *f, GError **error)
return anim;
}
#ifndef INCLUDE_ani
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (ani, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -1260,6 +1260,12 @@ gdk_pixbuf__bmp_image_save (FILE *f,
values, error);
}
#ifndef INCLUDE_bmp
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (bmp, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -1649,6 +1649,12 @@ gdk_pixbuf__gif_image_load_animation (FILE *file,
return animation;
}
#ifndef INCLUDE_gif
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (gif, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -1186,6 +1186,12 @@ gdk_pixbuf__ico_image_save (FILE *f,
return TRUE;
}
#ifndef INCLUDE_ico
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (ico, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -1067,6 +1067,12 @@ gdk_pixbuf__jpeg_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
#ifndef INCLUDE_jpeg
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (jpeg, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -723,6 +723,12 @@ gdk_pixbuf__pcx_stop_load(gpointer data, GError **error)
return TRUE;
}
#ifndef INCLUDE_pcx
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (pcx, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -994,6 +994,12 @@ gdk_pixbuf__png_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
#ifndef INCLUDE_png
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (png, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -1036,6 +1036,12 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
return TRUE;
}
#ifndef INCLUDE_pnm
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (pnm, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -513,6 +513,12 @@ gdk_pixbuf__ras_image_load_increment(gpointer data,
return TRUE;
}
#ifndef INCLUDE_ras
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (ras, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -953,6 +953,12 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
return TRUE;
}
#ifndef INCLUDE_tga
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (tga, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -806,6 +806,12 @@ gdk_pixbuf__tiff_image_save (FILE *f,
values, error);
}
#ifndef INCLUDE_tiff
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (tiff, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -339,6 +339,12 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
return TRUE;
}
#ifndef INCLUDE_wbmp
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (wbmp, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -457,6 +457,12 @@ gdk_pixbuf__xbm_image_load_increment (gpointer data,
return TRUE;
}
#ifndef INCLUDE_xbm
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (xbm, fill_vtable) (GdkPixbufModule *module)
{

View File

@ -781,6 +781,12 @@ gdk_pixbuf__xpm_image_load_increment (gpointer data,
return TRUE;
}
#ifndef INCLUDE_xpm
#define MODULE_ENTRY(type,function) function
#else
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
#endif
void
MODULE_ENTRY (xpm, fill_vtable) (GdkPixbufModule *module)
{