Skip site navigation (1)Skip section navigation (2)
Date:      23 Nov 2006 18:03:02 -0000
From:      Sven Berkvens-Matthijsse <sven@berkvens.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/105796: [PATCH] Port graphics/py-cairo does not compile with GCC 2.x
Message-ID:  <20061123180302.89342.qmail@cat.berkvens.net>
Resent-Message-ID: <200611231810.kANIADYT021399@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         105796
>Category:       ports
>Synopsis:       [PATCH] Port graphics/py-cairo does not compile with GCC 2.x
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 23 18:10:12 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Sven Berkvens-Matthijsse
>Release:        FreeBSD 4.10-STABLE i386
>Organization:
de Kattenfabriek
>Environment:
System: FreeBSD cat.berkvens.net 4.10-STABLE FreeBSD 4.10-STABLE #4: Sun Oct 31 01:46:30 CEST 2004 sven@cat.berkvens.net:/extra0/usr_obj/usr/src/sys/CAT i386
>Description:
	py-cairo does not compile with GCC 2.x due to the use of some C99
	features.
>How-To-Repeat:
	Build py-cairo on FreeBSD 4.x.
>Fix:
	The following two patch files will fix the problem and will not
	break anything for more recent versions of FreeBSD.

========== /usr/ports/graphics/py-cairo/files/patch-pycairo-font.c =========
--- cairo/pycairo-font.c.orig	Thu Nov 23 18:52:59 2006
+++ cairo/pycairo-font.c	Thu Nov 23 18:53:11 2006
@@ -197,6 +197,7 @@
     PycairoFontFace *ff;
     PycairoFontOptions *fo;
     PycairoMatrix *mx1, *mx2;
+    PyObject *o;
 
     if (!PyArg_ParseTuple(args, "O!O!O!O!:ScaledFont.__new__",
 			  &PycairoFontFace_Type, &ff,
@@ -205,7 +206,7 @@
 			  &PycairoFontOptions_Type, &fo))
 	return NULL;
 
-    PyObject *o = type->tp_alloc(type, 0);
+    o = type->tp_alloc(type, 0);
     if (o != NULL) {
 	cairo_scaled_font_t *scaled_font = cairo_scaled_font_create
 	    (ff->font_face, &mx1->matrix, &mx2->matrix, fo->font_options);
========================== END OF FILE =====================================


======== /usr/ports/graphics/py-cairo/files/patch-pycairo-surface.c =======
--- cairo/pycairo-surface.c.orig	Thu Nov 23 18:53:35 2006
+++ cairo/pycairo-surface.c	Thu Nov 23 18:55:42 2006
@@ -34,7 +34,9 @@
 #  include <config.h>
 #endif
 
+#if	defined(__FreeBSD__) && __FreeBSD__ >= 50000
 #include <stdint.h>
+#endif
 #include "pycairo-private.h"
 
 
@@ -519,6 +521,7 @@
 static PyObject *
 image_surface_create_from_png (PyTypeObject *type, PyObject *file)
 {
+    PyObject* reader;
     if (PyObject_TypeCheck (file, &PyBaseString_Type)) {
 	return PycairoSurface_FromSurface (
             cairo_image_surface_create_from_png (PyString_AsString(file)),
@@ -526,7 +529,7 @@
     }
 
     /* file or file-like object argument */
-    PyObject* reader = PyObject_GetAttrString (file, "read");
+    reader = PyObject_GetAttrString (file, "read");
     if (reader == NULL || !PyCallable_Check (reader)) {
 	Py_XDECREF(reader);
 	PyErr_SetString(PyExc_TypeError,
@@ -700,6 +703,7 @@
 {
     double width_in_points, height_in_points;
     PyObject *file;
+    PyObject* writer;
 
     if (!PyArg_ParseTuple(args, "Odd:PDFSurface.__new__",
 			  &file, &width_in_points, &height_in_points))
@@ -713,7 +717,7 @@
 	       NULL);
     }
     /* file or file-like object argument */
-    PyObject* writer = PyObject_GetAttrString (file, "write");
+    writer = PyObject_GetAttrString (file, "write");
     if (writer == NULL || !PyCallable_Check (writer)) {
 	Py_XDECREF(writer);
 	PyErr_SetString(PyExc_TypeError,
@@ -803,6 +807,7 @@
 {
     double width_in_points, height_in_points;
     PyObject *file;
+    PyObject* writer;
 
     if (!PyArg_ParseTuple(args, "Odd:PSSurface.__new__",
 			  &file, &width_in_points, &height_in_points))
@@ -817,7 +822,7 @@
 
     }
     /* else: file or file-like object argument */
-    PyObject* writer = PyObject_GetAttrString (file, "write");
+    writer = PyObject_GetAttrString (file, "write");
     if (writer == NULL || !PyCallable_Check (writer)) {
 	Py_XDECREF(writer);
 	PyErr_SetString(PyExc_TypeError,
@@ -942,6 +947,7 @@
 {
     double width_in_points, height_in_points;
     PyObject *file;
+    PyObject* writer;
 
     if (!PyArg_ParseTuple(args, "Odd:SVGSurface.__new__",
 			  &file, &width_in_points, &height_in_points))
@@ -955,7 +961,7 @@
 	       NULL);
     }
     /* else: file or file-like object argument */
-    PyObject* writer = PyObject_GetAttrString (file, "write");
+    writer = PyObject_GetAttrString (file, "write");
     if (writer == NULL || !PyCallable_Check (writer)) {
 	Py_XDECREF(writer);
 	PyErr_SetString(PyExc_TypeError,
========================== END OF FILE =====================================
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061123180302.89342.qmail>