Clean up AskPluginLoad logic.
This commit is contained in:
parent
0e1a34a4d7
commit
38c01714d7
@ -917,36 +917,34 @@ LoadRes CPluginManager::LoadPlugin(CPlugin **aResult, const char *path, bool deb
|
|||||||
|
|
||||||
CPlugin *plugin = CompileAndPrep(path, error, maxlength);
|
CPlugin *plugin = CompileAndPrep(path, error, maxlength);
|
||||||
|
|
||||||
LoadRes loadFailure = LoadRes_Failure;
|
// Assign our outparam so we can return early. It must be set.
|
||||||
/* Get the status */
|
*aResult = plugin;
|
||||||
if (pPlugin->GetStatus() == Plugin_Created) {
|
|
||||||
APLRes result = pPlugin->Call_AskPluginLoad(error, maxlength);
|
if (plugin->GetStatus() != Plugin_Created)
|
||||||
|
return LoadRes_Failure;
|
||||||
|
|
||||||
|
APLRes result = plugin->Call_AskPluginLoad(error, maxlength);
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case APLRes_Success:
|
case APLRes_Success:
|
||||||
/* Autoload any modules */
|
if (!LoadOrRequireExtensions(plugin, 1, error, maxlength))
|
||||||
LoadOrRequireExtensions(pPlugin, 1, error, maxlength);
|
return LoadRes_Failure;
|
||||||
break;
|
return LoadRes_Successful;
|
||||||
|
|
||||||
case APLRes_Failure:
|
case APLRes_Failure:
|
||||||
pPlugin->SetErrorState(Plugin_Failed, "%s", error);
|
plugin->SetErrorState(Plugin_Failed, "%s", error);
|
||||||
loadFailure = LoadRes_Failure;
|
return LoadRes_Failure;
|
||||||
break;
|
|
||||||
case APLRes_SilentFailure:
|
case APLRes_SilentFailure:
|
||||||
pPlugin->SetErrorState(Plugin_Failed, "%s", error);
|
plugin->SetErrorState(Plugin_Failed, "%s", error);
|
||||||
loadFailure = LoadRes_SilentFailure;
|
plugin->SetSilentlyFailed();
|
||||||
pPlugin->SetSilentlyFailed();
|
return LoadRes_SilentFailure;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
assert(false);
|
return LoadRes_Failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aResult)
|
|
||||||
*aResult = pPlugin;
|
|
||||||
|
|
||||||
return (pPlugin->GetStatus() == Plugin_Loaded) ? LoadRes_Successful : loadFailure;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t maxlength, bool *wasloaded)
|
IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t maxlength, bool *wasloaded)
|
||||||
{
|
{
|
||||||
CPlugin *pl;
|
CPlugin *pl;
|
||||||
|
Loading…
Reference in New Issue
Block a user