Mercurial > hg > vampy-host
diff vampyhost.cpp @ 2:e30eda0b5e2d
Fix peculiar return types
author | Chris Cannam |
---|---|
date | Thu, 31 Jan 2013 13:03:47 +0000 |
parents | cb0d3af1be4d |
children | f12ab1553882 |
line wrap: on
line diff
--- a/vampyhost.cpp Mon Oct 29 08:20:06 2012 +0000 +++ b/vampyhost.cpp Thu Jan 31 13:03:47 2013 +0000 @@ -39,42 +39,42 @@ /* MODULE HELPER FUNCTIONS */ -PyDoc_STRVAR(xx_foo_doc, "Some description"); +PyDoc_STRVAR(xx_foo_doc, "Some description"); //!!! /*obtain C plugin handle and key from pyCobject */ -int getPluginHandle +bool getPluginHandle (PyObject *pyPluginHandle, Plugin **plugin, string **pKey=NULL) { //char errormsg[]="Wrong input argument: Plugin Handle required."; *plugin = NULL; - if (!PyCObject_Check(pyPluginHandle)) return NULL; + if (!PyCObject_Check(pyPluginHandle)) return false; //try to convert to Plugin pointer Plugin *p = (Plugin*) PyCObject_AsVoidPtr(pyPluginHandle); - if (!p) return NULL; + if (!p) return false; string pId; if (pKey) { *pKey = (string*) PyCObject_GetDesc(pyPluginHandle); - if (!*pKey) return NULL; + if (!*pKey) return false; pId = *(string*) *pKey; } else { void *pKey = PyCObject_GetDesc(pyPluginHandle); - if (!pKey) return NULL; + if (!pKey) return false; pId = *(string*) pKey; } string::size_type pos = pId.find(':'); - if (pos == string::npos) return NULL; + if (pos == string::npos) return false; pId = pId.substr(pId.rfind(':')+1); string identifier = p->getIdentifier(); - if (pId.compare(identifier)) return NULL; + if (pId.compare(identifier)) return false; *plugin = p; return true;