avoid deprecated string conversion warning in pycairo by overriding Pycairo_Import macro and casting away const to please the c/c++ borderlands

This commit is contained in:
Dane Springmeyer 2011-04-04 04:40:18 +00:00
parent a7410da0d8
commit 7cc4f345cf
2 changed files with 11 additions and 10 deletions

View file

@ -295,14 +295,16 @@ bool has_cairo()
bool has_pycairo()
{
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
Pycairo_IMPORT;
/*!
Case where pycairo support has been compiled into
mapnik but at runtime the cairo python module
is unable to be imported and therefore Pycairo surfaces
and contexts cannot be passed to mapnik.render()
*/
if (Pycairo_CAPI == NULL) return false;
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
if (Pycairo_CAPI == NULL){
/*
Case where pycairo support has been compiled into
mapnik but at runtime the cairo python module
is unable to be imported and therefore Pycairo surfaces
and contexts cannot be passed to mapnik.render()
*/
return false;
}
return true;
#else
return false;

View file

@ -56,8 +56,7 @@ static void *extract_context(PyObject* op)
void register_cairo()
{
Pycairo_IMPORT;
Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import(const_cast<char *>("cairo"), const_cast<char *>("CAPI"));
if (Pycairo_CAPI == NULL) return;
boost::python::converter::registry::insert(&extract_surface, boost::python::type_id<PycairoSurface>());