From 1d0b765f618f4791d75a1226756d4568ca35be3c Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 16 Oct 2009 08:51:24 +0000 Subject: properly check plug-in version. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2285 ee746299-78ed-0310-b773-934348b2243d --- src/plugin.c | 12 +++++++++--- src/plugin.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugin.c b/src/plugin.c index 16f9e0ef..087b56d8 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -174,12 +174,10 @@ gint syl_plugin_load(const gchar *name) if (g_module_symbol(module, "plugin_load", (gpointer *)&load_func)) { if (!syl_plugin_check_version(module)) { -#if 0 g_warning("Version check failed. Skipping: %s", name); g_module_close(module); g_free(file); return -1; -#endif } debug_print("calling plugin_load() in %s\n", @@ -286,6 +284,10 @@ gboolean syl_plugin_check_version(GModule *module) { gint (*version_func)(void); gint ver; + gint a_major; + gint a_minor; + gint p_major; + gint p_minor; g_return_val_if_fail(module != NULL, FALSE); @@ -300,7 +302,11 @@ gboolean syl_plugin_check_version(GModule *module) return FALSE; } - if (ver == SYL_PLUGIN_INTERFACE_VERSION) { + a_major = SYL_PLUGIN_INTERFACE_VERSION & 0xff00; + a_minor = SYL_PLUGIN_INTERFACE_VERSION & 0x00ff; + p_major = ver & 0xff00; + p_minor = ver & 0x00ff; + if (a_major == p_major && a_minor >= p_minor) { debug_print("Version OK: plugin: %d, app: %d\n", ver, SYL_PLUGIN_INTERFACE_VERSION); return TRUE; diff --git a/src/plugin.h b/src/plugin.h index 238bab87..0fe7be0c 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -45,7 +45,7 @@ typedef void (*SylPluginLoadFunc) (void); typedef void (*SylPluginUnloadFunc) (void); typedef void (*SylPluginCallbackFunc) (void); -#define SYL_PLUGIN_INTERFACE_VERSION 0x0100 +#define SYL_PLUGIN_INTERFACE_VERSION 0x0101 struct _SylPlugin { -- cgit v1.2.3