From afe735b89bf4a1f0aed233e950d30b2b5c426d89 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 11 Aug 2010 12:50:38 +0000 Subject: [PATCH] r5051 git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/Geany-0_19_1@5132 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 8 ++++++++ doc/plugins.dox | 2 +- src/plugindata.h | 12 +++++++----- src/plugins.c | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2227212f9..4c0c533a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-18 Nick Treleaven + + * src/plugindata.h, src/plugins.c, doc/plugins.dox: + Fix not loading plugins built against a newer API when Geany doesn't + provide the required version given in PLUGIN_VERSION_CHECK(). + Improve documentation for PLUGIN_VERSION_CHECK(). + + 2010-06-16 Nick Treleaven * src/notebook.c: diff --git a/doc/plugins.dox b/doc/plugins.dox index df156eb79..b61fd92d2 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -43,7 +43,7 @@ * @section pluginsupport Plugin Support * - @link howto Plugin HowTo @endlink - get started * - @link pluginsymbols.c Plugin Symbols @endlink - * - @link plugindata.h Main Datatypes and Macros @endlink + * - @link plugindata.h Plugin Datatypes and Macros @endlink * - @link signals Plugin Signals @endlink * - @link pluginutils.h Plugin Utility Functions @endlink * - @link guidelines Plugin Writing Guidelines @endlink diff --git a/src/plugindata.h b/src/plugindata.h index 5405639f0..0dcfedba8 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -59,18 +59,20 @@ enum { GEANY_ABI_VERSION = 66 }; -/** Checks the plugin can be loaded by Geany. +/** Defines a function to check the plugin is safe to load. * This performs runtime checks that try to ensure: * - Geany ABI data types are compatible with this plugin. - * - Geany sources provide the required API for this plugin. */ + * - Geany sources provide the required API for this plugin. + * @param api_required The minimum API number your plugin requires. + * Look at the source for the value of @c GEANY_API_VERSION to use if you + * want your plugin to require the current Geany version on your machine. + * You should update this value when using any new API features. */ #define PLUGIN_VERSION_CHECK(api_required) \ gint plugin_version_check(gint abi_ver) \ { \ if (abi_ver != GEANY_ABI_VERSION) \ return -1; \ - if (GEANY_API_VERSION < (api_required)) \ - return (api_required); \ - else return 0; \ + return (api_required); \ } diff --git a/src/plugins.c b/src/plugins.c index 826911179..fe03cc905 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -467,7 +467,7 @@ plugin_check_version(GModule *module) "release of Geany - recompile it.", g_module_name(module)); return FALSE; } - if (result > 0) + if (result > GEANY_API_VERSION) { geany_debug("Plugin \"%s\" requires a newer version of Geany (API >= v%d).", g_module_name(module), result); -- 2.11.4.GIT