va_end(arglist);
return strdup(buf);
}
-#define PY_ERROR(s,args...) (PyErr_SetString(PyExc_Exception, strf(s, ## args)),NULL)
+#define PY_ERROR(s,args...) (PyErr_SetString(PyExc_Exception, strf(s, ## args)),(PyObject*)NULL)
#define PY_NONE Py_BuildValue("s", 0)
//---------------------------------------------------------------------
static gfximage_t*toImage(PyObject*_bitmap)
{
if(!_bitmap || !_bitmap->ob_type->tp_name || strcmp(_bitmap->ob_type->tp_name, "Image")) {
- return PY_ERROR("Second argument to fillbitmap must be an image");
+ PY_ERROR("Second argument to fillbitmap must be an image");
+ return 0;
}
ImageObject*bitmap = (ImageObject*)_bitmap;
return bitmap->image;
return PY_ERROR("coordinates must be floats");
}
}
- gfxline_t*l = malloc(sizeof(gfxline_t));
+ gfxline_t*l = (gfxline_t*)malloc(sizeof(gfxline_t));
memset(l, 0, sizeof(gfxline_t));
last->next = l;
last = l;
return NULL;
OutputObject*self = PyObject_New(OutputObject, &OutputClass);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
gfxdevice_swf_init(self->output_device);
return (PyObject*)self;
}
return NULL;
OutputObject*self = PyObject_New(OutputObject, &OutputClass);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
gfxdevice_ocr_init(self->output_device);
return (PyObject*)self;
}
return NULL;
OutputObject*self = PyObject_New(OutputObject, &OutputClass);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
gfxdevice_render_init(self->output_device);
return (PyObject*)self;
}
return NULL;
OutputObject*self = PyObject_New(OutputObject, &OutputClass);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
gfxdevice_text_init(self->output_device);
return (PyObject*)self;
}
return NULL;
OutputObject*self = PyObject_New(OutputObject, &OutputClass);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
gfxdevice_opengl_init(self->output_device);
return (PyObject*)self;
}
self->pyobj = obj;
Py_INCREF(obj);
- self->output_device = malloc(sizeof(gfxdevice_t));
+ self->output_device = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
memset(self->output_device, 0, sizeof(gfxdevice_t));
self->output_device->name = strdup("passthrough");
gfxresult_t*result = dev2.finish(&dev2);
gfximage_t*img = (gfximage_t*)result->get(result,"page0");
int l = img->width*img->height;
- unsigned char*data = malloc(img->width*img->height*3);
+ unsigned char*data = (unsigned char*)malloc(img->width*img->height*3);
int s,t;
for(t=0,s=0;t<l;s+=3,t++) {
data[s+0] = img->data[t].r;