diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-16 08:51:24 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-16 08:51:24 +0000 |
commit | 1d0b765f618f4791d75a1226756d4568ca35be3c (patch) | |
tree | 4b6dc11d36b052a8ed529e744c47d2624aeb7372 | |
parent | 7633da4efcb1ce694f02759838bd10e6366c7846 (diff) |
properly check plug-in version.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2285 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/plugin.c | 12 | ||||
-rw-r--r-- | src/plugin.h | 2 |
3 files changed, 14 insertions, 4 deletions
@@ -1,5 +1,9 @@ 2009-10-16 + * src/plugin.[ch]: properly check plug-in version. + +2009-10-16 + * libsylph/codeconv.c: made codeconv module thread-safe. * src/query_search.c: update search window using timer. 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 { |