[Kst] [Bug 88086] plugin error returns need to be enhanced
George Staikos
staikos at kde.org
Mon Nov 1 17:06:13 CET 2004
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=88086
staikos kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From staikos kde org 2004-11-01 17:06 -------
CVS commit by staikos:
1) get rid of symbol warnings in KstDataSource
2) add support for custom strings in plugin errors
BUG: 88086
M +5 -1 kstdatasource.cpp 1.45
M +10 -0 kstplugin.cpp 1.77
M +10 -0 plugin.cpp 1.28
M +2 -1 plugin.h 1.33
M +4 -0 pluginloader.cpp 1.16
--- kdeextragear-2/kst/kst/kstdatasource.cpp #1.44:1.45
@ -143,5 +143,9 @ namespace KST {
// FIXME: might be a good idea to cache this per-symbol
- return _lib->symbol(QFile::encodeName(sym + "_" + _plugLib));
+ QCString s = QFile::encodeName(sym + "_" + _plugLib);
+ if (_lib->hasSymbol(s)) {
+ return _lib->symbol(s);
+ }
+ return 0L;
}
--- kdeextragear-2/kst/kst/kstplugin.cpp #1.76:1.77
@ -323,4 +323,14 @ KstObject::UpdateType KstPlugin::update(
}
_lastError = QString::null;
+ } else if (rc > 0) {
+ if (_lastError.isEmpty()) {
+ const char *err = _plugin->errorCode(rc);
+ if (err && *err) {
+ _lastError = err;
+ KstDebug::self()->log(i18n("Plugin %1 produced error: %2.").arg(tagName()).arg(_lastError), KstDebug::Error);
+ } else {
+ _lastError = QString::null;
+ }
+ }
} else {
bool doSend = _lastError.isEmpty() ? true : false;
--- kdeextragear-2/kst/kst/plugin.cpp #1.27:1.28
@ -30,4 +30,5 @ Plugin::Plugin() : KstShared() {
_symbol = 0L;
_freeSymbol = 0L;
+ _errorSymbol = 0L;
_parameterName = 0L;
//kdDebug() << "Creating Plugin: " << long(this) << endl;
@ -38,4 +39,5 @ Plugin::~Plugin() {
_symbol = 0L;
_freeSymbol = 0L;
+ _errorSymbol = 0L;
_parameterName = 0L;
@ -198,3 +200,11 @ bool Plugin::freeLocalData(void **local)
}
+
+const char *Plugin::errorCode(int code) const {
+ if (_errorSymbol) {
+ return ((const char *(*)(int))_errorSymbol)(code);
+ }
+ return 0L;
+}
+
// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/plugin.h #1.32:1.33
@ -58,4 +58,5 @ class Plugin : public KstShared {
QString parameterName(int index) const;
bool freeLocalData(void **local) const;
+ const char *errorCode(int code) const;
static const int CallError;
@ -143,5 +144,5 @ class Plugin : public KstShared {
KLibrary *_lib;
- void *_symbol, *_freeSymbol;
+ void *_symbol, *_freeSymbol, *_errorSymbol;
void *_parameterName;
--- kdeextragear-2/kst/kst/pluginloader.cpp #1.15:1.16
@ -76,4 +76,8 @ Plugin *PluginLoader::loadPlugin(const Q
}
+ if (plug->_lib->hasSymbol("errorCode")) {
+ plug->_errorSymbol = plug->_lib->symbol("errorCode");
+ }
+
if (!plug->_symbol) {
KstDebug::self()->log(i18n("Could not find symbol '%1' in plugin %2.").arg(plug->_data._name).arg(object), KstDebug::Error);
More information about the Kst
mailing list