diff -r -u ../pycairo-1.8.6/cairo/pycairo-font.c ./cairo/pycairo-font.c --- ../pycairo-1.8.6/cairo/pycairo-font.c Sun Jun 21 12:45:30 2009 +++ ./cairo/pycairo-font.c Fri Jun 26 20:41:34 2009 @@ -155,6 +155,7 @@ static PyObject * toy_font_face_new (PyTypeObject *type, PyObject *args, PyObject *kwds) { + PyObject *o = NULL; PyObject *obj; PyObject *pyUTF8 = NULL; const char *utf8family = NULL; @@ -181,7 +182,7 @@ if (utf8family == NULL) return NULL; - PyObject *o = PycairoFontFace_FromFontFace ( + o = PycairoFontFace_FromFontFace ( cairo_toy_font_face_create (utf8family, slant, weight)); Py_XDECREF(pyUTF8); return o; diff -r -u ../pycairo-1.8.6/cairo/pycairo-matrix.c ./cairo/pycairo-matrix.c --- ../pycairo-1.8.6/cairo/pycairo-matrix.c Sat Jun 13 12:27:46 2009 +++ ./cairo/pycairo-matrix.c Fri Jun 26 20:44:23 2009 @@ -104,12 +104,12 @@ matrix_multiply (PycairoMatrix *o, PyObject *args) { PycairoMatrix *mx2; + cairo_matrix_t result; if (!PyArg_ParseTuple(args, "O!:Matrix.multiply", &PycairoMatrix_Type, &mx2)) return NULL; - cairo_matrix_t result; cairo_matrix_multiply (&result, &o->matrix, &mx2->matrix); return PycairoMatrix_FromMatrix (&result); } diff -r -u ../pycairo-1.8.6/cairo/pycairo-surface.c ./cairo/pycairo-surface.c --- ../pycairo-1.8.6/cairo/pycairo-surface.c Sat Mar 21 02:44:47 2009 +++ ./cairo/pycairo-surface.c Fri Jun 26 20:47:27 2009 @@ -469,6 +469,7 @@ _read_func (void *closure, unsigned char *data, unsigned int length) { char *buffer; + int ret; Py_ssize_t str_length; cairo_status_t status = CAIRO_STATUS_READ_ERROR; PyGILState_STATE gstate = PyGILState_Ensure(); @@ -480,8 +481,9 @@ */ goto end; } - int ret = PyString_AsStringAndSize(pystr, &buffer, &str_length); - if (ret == -1 || str_length < length) { + + ret = PyString_AsStringAndSize(pystr, &buffer, &str_length); + if (ret == -1 || (unsigned int)str_length < length) { goto end; } /* don't use strncpy() since png data may contain NUL bytes */ @@ -879,9 +881,12 @@ ps_surface_ps_level_to_string (PyObject *self, PyObject *args) { int level; + const char *s; + if (!PyArg_ParseTuple(args, "i:ps_level_to_string", &level)) - return NULL; - const char *s = cairo_ps_level_to_string (level); + return NULL; + + s = cairo_ps_level_to_string (level); if (s == NULL){ PyErr_SetString(CairoError, "ps_level_to_string: " "invalid level argument"); diff -r -u ../pycairo-1.8.6/setup.py ./setup.py --- ../pycairo-1.8.6/setup.py Thu Jun 25 09:39:41 2009 +++ ./setup.py Mon Jun 29 23:37:51 2009 @@ -3,6 +3,8 @@ import distutils.core as dic import distutils.dir_util as dut import distutils.file_util as fut +import distutils.sysconfig as cfg +import distutils.command.install_data as instdata import subprocess import sys @@ -31,6 +33,11 @@ opt = opt[-2:] return [x.lstrip(opt) for x in output.split()] +def get_install_data_dir_set (): + for arg in sys.argv[1:]: + if arg.startswith('--install-data='): + return True + return False if sys.version_info < (2,6): raise SystemExit('Error: Python >= 2.6 is required') @@ -38,6 +45,12 @@ pkg_config_version_check ('cairo', cairo_version_required) if sys.platform == 'win32': runtime_library_dirs = [] + + CAIRO_PREFIX = call('pkg-config --variable=prefix cairo').stdout.read() + CAIRO_PREFIX = CAIRO_PREFIX.split()[0].replace('/', '\\') + + if (not get_install_data_dir_set()) and 'install' in sys.argv: + sys.argv.append('--install-data='+CAIRO_PREFIX) else: runtime_library_dirs = pkg_config_parse('--libs-only-L', 'cairo')