From: Alexander Larsson Date: Wed, 5 Dec 2007 11:05:49 +0000 (+0000) Subject: Fix warnings X-Git-Tag: GLIB_2_15_1~203 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f039bd490856afab9d0eff22fbaeeadaef651a2;p=platform%2Fupstream%2Fglib.git Fix warnings 2007-12-05 Alexander Larsson * gdatainputstream.c: Fix warnings * gio.symbols: * giomodule.[ch] * glocaldirectorymonitor.c: * glocalfilemonitor.c: * gunionvolumemonitor.c: * gvfs.c: Make g_io_modules_ensure_loaded a private function and don't pass in the dirname. This means we can do magic directory finding in the win32 version. Export the actual load-modules-in-directory code so that gvfs can reuse that. svn path=/trunk/; revision=6050 --- diff --git a/gio/ChangeLog b/gio/ChangeLog index 6b2f1e7..9869395 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,22 @@ 2007-12-05 Alexander Larsson + * gdatainputstream.c: + Fix warnings + + * gio.symbols: + * giomodule.[ch] + * glocaldirectorymonitor.c: + * glocalfilemonitor.c: + * gunionvolumemonitor.c: + * gvfs.c: + Make g_io_modules_ensure_loaded a private function and + don't pass in the dirname. This means we can do magic + directory finding in the win32 version. + Export the actual load-modules-in-directory code so that + gvfs can reuse that. + +2007-12-05 Alexander Larsson + * gbufferedinputstream.c: * gbufferedoutputstream.c: * gdrive.[ch]: diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c index b5fdd6a..1130c1c 100644 --- a/gio/gdatainputstream.c +++ b/gio/gdatainputstream.c @@ -650,7 +650,7 @@ scan_for_newline (GDataInputStream *stream, newline_len = 0; start = checked; - buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start; + buffer = (const char*)g_buffered_input_stream_peek_buffer (bstream, &available) + start; end = available; peeked = end - start; @@ -826,7 +826,7 @@ scan_for_chars (GDataInputStream *stream, found_pos = -1; start = checked; - buffer = (guint8*)g_buffered_input_stream_peek_buffer (bstream, &available) + start; + buffer = (const char *)g_buffered_input_stream_peek_buffer (bstream, &available) + start; end = available; peeked = end - start; diff --git a/gio/gio.symbols b/gio/gio.symbols index db331fa..0102353 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -499,7 +499,7 @@ g_io_error_from_errno #if IN_FILE(__G_IO_MODULE_C__) g_io_module_get_type G_GNUC_CONST g_io_module_new -g_io_modules_ensure_loaded +g_io_modules_load_all_in_directory #endif #endif diff --git a/gio/giomodule.c b/gio/giomodule.c index 02d12d6..8312d80 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -23,6 +23,7 @@ #include #include "giomodule.h" +#include "giomodule-priv.h" #include "gioalias.h" @@ -31,7 +32,8 @@ * @short_description: Loadable GIO Modules * * Provides an interface and default functions for loading and unloading - * GIO modules. + * modules. This is used internally to make gio extensible, but can also + * be used by other to implement module loading. * **/ @@ -139,9 +141,10 @@ g_io_module_unload_module (GTypeModule *gmodule) /** * g_io_module_new: - * @filename: filename of the module to load. + * @filename: filename of the shared library module. * - * Loads a new module into GIO. + * Creates a new GIOModule that will load the specific + * shared library when in use. * * Returns: a #GIOModule from given @filename, * or %NULL on error. @@ -171,8 +174,16 @@ is_valid_module_name (const gchar *basename) #endif } -static GList * -load_modules (const char *dirname) +/** + * g_io_modules_load_all_in_directory: + * @dirname: pathname for a directory containing modules to load. + * + * Loads all the modules in the the specified directory. + * + * Returns: a list of #GIOModules loaded from the directory + **/ +GList * +g_io_modules_load_all_in_directory (const char *dirname) { const gchar *name; GDir *dir; @@ -218,33 +229,21 @@ load_modules (const char *dirname) } G_LOCK_DEFINE_STATIC (loaded_dirs); -static GHashTable *loaded_dirs = NULL; -/** - * g_io_modules_ensure_loaded: - * @directory: string containing a directory path. - * - * Loads all of the modules within the @directory. - **/ void -g_io_modules_ensure_loaded (const char *directory) +_g_io_modules_ensure_loaded (void) { GList *modules; + const char *directory; + static gboolean loaded_dirs = FALSE; - g_return_if_fail (directory != NULL); G_LOCK (loaded_dirs); - if (loaded_dirs == NULL) - loaded_dirs = g_hash_table_new (g_str_hash, g_str_equal); - - if (!g_hash_table_lookup_extended (loaded_dirs, directory, - NULL, NULL)) + if (!loaded_dirs) { - modules = load_modules (directory); - g_hash_table_insert (loaded_dirs, - g_strdup (directory), - modules); + loaded_dirs = TRUE; + modules = g_io_modules_load_all_in_directory (GIO_MODULE_DIR); } G_UNLOCK (loaded_dirs); diff --git a/gio/giomodule.h b/gio/giomodule.h index 031f349..36b6de7 100644 --- a/gio/giomodule.h +++ b/gio/giomodule.h @@ -46,7 +46,7 @@ typedef struct _GIOModuleClass GIOModuleClass; GType g_io_module_get_type (void) G_GNUC_CONST; GIOModule *g_io_module_new (const gchar *filename); -void g_io_modules_ensure_loaded (const char *directory); +GList * g_io_modules_load_all_in_directory (const char *dirname); /* API for the modules to implement */ /** diff --git a/gio/glocaldirectorymonitor.c b/gio/glocaldirectorymonitor.c index b8abf2c..b2c473e 100644 --- a/gio/glocaldirectorymonitor.c +++ b/gio/glocaldirectorymonitor.c @@ -222,7 +222,7 @@ get_default_local_directory_monitor (gpointer data) _g_inotify_directory_monitor_get_type (); #endif - g_io_modules_ensure_loaded (GIO_MODULE_DIR); + _g_io_modules_ensure_loaded (); monitor_impls = g_type_children (G_TYPE_LOCAL_DIRECTORY_MONITOR, &n_monitor_impls); diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c index d083927..1820db9 100644 --- a/gio/glocalfilemonitor.c +++ b/gio/glocalfilemonitor.c @@ -158,7 +158,7 @@ get_default_local_file_monitor (gpointer data) _g_inotify_file_monitor_get_type (); #endif - g_io_modules_ensure_loaded (GIO_MODULE_DIR); + _g_io_modules_ensure_loaded (); monitor_impls = g_type_children (G_TYPE_LOCAL_FILE_MONITOR, &n_monitor_impls); diff --git a/gio/gunionvolumemonitor.c b/gio/gunionvolumemonitor.c index 0958963..faaa3c1 100644 --- a/gio/gunionvolumemonitor.c +++ b/gio/gunionvolumemonitor.c @@ -259,7 +259,7 @@ get_default_native_type (gpointer data) #endif /* Ensure vfs in modules loaded */ - g_io_modules_ensure_loaded (GIO_MODULE_DIR); + _g_io_modules_ensure_loaded (); monitors = g_type_children (G_TYPE_NATIVE_VOLUME_MONITOR, &n_monitors); native_type = 0; diff --git a/gio/gvfs.c b/gio/gvfs.c index af4a9dc..8f69191 100644 --- a/gio/gvfs.c +++ b/gio/gvfs.c @@ -220,7 +220,7 @@ get_default_vfs (gpointer arg) local_type = casted_get_type (); /* Ensure vfs in modules loaded */ - g_io_modules_ensure_loaded (GIO_MODULE_DIR); + _g_io_modules_ensure_loaded (); vfs_impls = g_type_children (G_TYPE_VFS, &n_vfs_impls);