$NetBSD: patch-ac,v 1.2 2009/05/13 12:56:47 obache Exp $

--- src/surface.c.orig	2009-08-26 10:59:35.000000000 +0000
+++ src/surface.c
@@ -118,7 +118,7 @@ static cairo_status_t
 _write_func (void *closure, const unsigned char *data, unsigned int length) {
   PyGILState_STATE gstate = PyGILState_Ensure();
   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()
@@ -401,7 +401,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",
@@ -445,7 +445,7 @@ image_surface_create_for_data (PyTypeObj
 static cairo_status_t
 _read_func (void *closure, unsigned char *data, unsigned int length) {
   char *buffer;
-  Py_ssize_t str_length;
+  int str_length;
   cairo_status_t status = CAIRO_STATUS_READ_ERROR;
   PyGILState_STATE gstate = PyGILState_Ensure();
   PyObject *pystr = PyObject_CallMethod ((PyObject *)closure, "read", "(i)",
@@ -585,10 +585,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[] = {
