$NetBSD: patch-ac,v 1.1 2008/11/18 12:46:52 drochner Exp $

--- cairo/pycairo-surface.c.orig	2008-11-18 12:50:34.000000000 +0100
+++ cairo/pycairo-surface.c
@@ -122,7 +122,7 @@ static cairo_status_t
 _write_func (void *closure, const unsigned char *data, unsigned int length)
 {
     PyObject *res = PyObject_CallMethod ((PyObject *)closure, "write", "(s#)",
-					 data, (Py_ssize_t)length);
+					 data, length);
     if (res == NULL) {
 	/* an exception has occurred, it will be picked up later by
 	 * Pycairo_Check_Status()
@@ -392,7 +392,7 @@ image_surface_create_for_data (PyTypeObj
     cairo_format_t format;
     unsigned char *buffer;
     int width, height, stride = -1, res;
-    Py_ssize_t buffer_len;
+    int buffer_len;
     PyObject *obj;
 
     if (!PyArg_ParseTuple(args, "Oiii|i:Surface.create_for_data",
@@ -570,10 +570,10 @@ image_surface_buffer_getsegcount (Pycair
 
 /* See Python C API Manual 10.7 */
 static PyBufferProcs image_surface_as_buffer = {
-    (readbufferproc) image_surface_buffer_getreadbuf,
-    (writebufferproc)image_surface_buffer_getwritebuf,
-    (segcountproc)   image_surface_buffer_getsegcount,
-    (charbufferproc) NULL,
+    (getreadbufferproc) image_surface_buffer_getreadbuf,
+    (getwritebufferproc)image_surface_buffer_getwritebuf,
+    (getsegcountproc)   image_surface_buffer_getsegcount,
+    (getcharbufferproc) NULL,
 };
 
 static PyMethodDef image_surface_methods[] = {
