[Scummvm-cvs-logs] SF.net SVN: scummvm:[51678] scummvm/branches/gsoc2010-plugins/backends/ plugins/elf-provider.cpp
toneman1138 at users.sourceforge.net
toneman1138 at users.sourceforge.net
Tue Aug 3 09:52:10 CEST 2010
Revision: 51678
http://scummvm.svn.sourceforge.net/scummvm/?rev=51678&view=rev
Author: toneman1138
Date: 2010-08-03 07:52:10 +0000 (Tue, 03 Aug 2010)
Log Message:
-----------
got rid of dlerr[MAXDLERRLEN]
Modified Paths:
--------------
scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp
Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp 2010-08-03 06:25:03 UTC (rev 51677)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf-provider.cpp 2010-08-03 07:52:10 UTC (rev 51678)
@@ -31,8 +31,6 @@
#include "backends/plugins/elf-loader.h"
-static char dlerr[MAXDLERRLEN];
-
class ELFPlugin : public DynamicPlugin {
protected:
void *_dlHandle;
@@ -40,14 +38,20 @@
virtual VoidFunc findSymbol(const char *symbol) {
void *func;
+ bool handleNull;
if (_dlHandle == NULL) {
- strcpy(dlerr, "Handle is NULL.");
func = NULL;
+ handleNull = true;
} else {
func = ((DLObject *)_dlHandle)->symbol(symbol);
}
- if (!func)
- warning("Failed loading symbol '%s' from plugin '%s' (%s)", symbol, _filename.c_str(), dlerr);
+ if (!func) {
+ if (handleNull) {
+ warning("Failed loading symbol '%s' from plugin '%s' (Handle is NULL)", symbol, _filename.c_str());
+ } else {
+ warning("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
+ }
+ }
// FIXME HACK: This is a HACK to circumvent a clash between the ISO C++
// standard and POSIX: ISO C++ disallows casting between function pointers
@@ -69,7 +73,7 @@
bool loadPlugin() {
assert(!_dlHandle);
- DLObject *obj = new DLObject(dlerr);
+ DLObject *obj = new DLObject(NULL);
if (obj->open(_filename.c_str())) {
_dlHandle = (void *)obj;
} else {
@@ -78,7 +82,7 @@
}
if (!_dlHandle) {
- warning("Failed loading plugin '%s' (%s)", _filename.c_str(), dlerr);
+ warning("Failed loading plugin '%s'", _filename.c_str());
return false;
}
@@ -97,12 +101,11 @@
if (_dlHandle) {
DLObject *obj = (DLObject *)_dlHandle;
if (obj == NULL) {
- strcpy(dlerr, "Handle is NULL.");
- warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerr);
+ warning("Failed unloading plugin '%s' (Handle is NULL)", _filename.c_str());
} else if (obj->close()) {
delete obj;
} else {
- warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerr);
+ warning("Failed unloading plugin '%s'", _filename.c_str());
}
_dlHandle = 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list