From: stephan b. <sg...@us...> - 2004-12-25 00:11:59
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20210/src/System Modified Files: SharedLib.ltdl.cpp Log Message: symbol fetching now throws when passed 0. Switched to std::string form of RunTimeError ctor. Index: SharedLib.ltdl.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.ltdl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SharedLib.ltdl.cpp 24 Dec 2004 23:03:40 -0000 1.3 +++ SharedLib.ltdl.cpp 25 Dec 2004 00:11:49 -0000 1.4 @@ -105,6 +105,10 @@ void* SharedLib::operator[](const char* symbol) throw(RuntimeError) { + if( ! symbol ) + { + throw RuntimeError( "Invalid symbol (null).", P_SOURCEINFO ); + } lt_handle_map_t::iterator it = lt_handle_map().find( _handle ); if( lt_handle_map().end() == it ) { @@ -114,9 +118,10 @@ void* addr = lt_dlsym( lth, symbol); if(!addr) { - std::ostringstream os; - os << "Symbol '"<<symbol<<"' not found in shared library."; - throw RuntimeError(os.str().c_str(), P_SOURCEINFO); + std::ostringstream os; + os << "Symbol '"<<symbol<<"' not found in shared library."; + throw RuntimeError(os.str(), P_SOURCEINFO); +// throw RuntimeError("Symbol not found in SharedLib.", P_SOURCEINFO); } return addr; |