fixed bugs in the external extension system

import of external SDK that's been sitting around for a while

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401674
This commit is contained in:
David Anderson
2007-11-10 05:46:09 +00:00
parent 6bda3e55b9
commit ca0da2559d
14 changed files with 854 additions and 4 deletions
+1 -1
View File
@@ -235,6 +235,6 @@ void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
*ret = (ptr == NULL) ? IFACE_FAILED : IFACE_OK;
}
return NULL;
return ptr;
}
+9 -2
View File
@@ -53,8 +53,8 @@ void CExtension::Initialize(const char *filename, const char *path)
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
{
m_pAPI = pAPI;
Initialize(filename, path);
m_pAPI = pAPI;
}
CLocalExtension::CLocalExtension(const char *filename)
@@ -200,7 +200,13 @@ CExtension::~CExtension()
bool CExtension::PerformAPICheck(char *error, size_t maxlength)
{
if (!m_pAPI || m_pAPI->GetExtensionVersion() > SMINTERFACE_EXTENSIONAPI_VERSION)
if (!m_pAPI)
{
snprintf(error, maxlength, "No IExtensionInterface instance provided");
return false;
}
if (m_pAPI->GetExtensionVersion() > SMINTERFACE_EXTENSIONAPI_VERSION)
{
snprintf(error, maxlength, "Extension version is too new to load (%d, max is %d)", m_pAPI->GetExtensionVersion(), SMINTERFACE_EXTENSIONAPI_VERSION);
return false;
@@ -1281,3 +1287,4 @@ IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
return pExt;
}