Mercurial > hg > vampy-host
changeset 2:e30eda0b5e2d
Fix peculiar return types
author | Chris Cannam |
---|---|
date | Thu, 31 Jan 2013 13:03:47 +0000 |
parents | cb0d3af1be4d |
children | f12ab1553882 |
files | Makefile vampyhost.cpp |
diffstat | 2 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Oct 29 08:20:06 2012 +0000 +++ b/Makefile Thu Jan 31 13:03:47 2013 +0000 @@ -1,8 +1,8 @@ PY_INCLUDE_PATH := /usr/include/python2.7 -CFLAGS := -O2 -Wall -I$(PY_INCLUDE_PATH) -I. -CXXFLAGS := -O2 -Wall -I$(PY_INCLUDE_PATH) -I. +CFLAGS := -O2 -fPIC -Wall -I$(PY_INCLUDE_PATH) -I. +CXXFLAGS := -O2 -fPIC -Wall -I$(PY_INCLUDE_PATH) -I. LDFLAGS := -shared -lpython2.7 -lvamp-hostsdk #LDFLAGS := -dynamiclib -lpython2.5 /usr/lib/libvamp-hostsdk.a
--- 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;