From ead0dad73514f706fdd7943eb7a5690e86fa8eaf Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Fri, 8 Feb 2008 14:42:37 +0000 Subject: [PATCH] gis: geos: Fixed declaration of `geos_version` to explicitly set restype to `c_char_p` due to incompatibilities with 64-bit platforms. Thanks jlivni. git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7100 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/geos/libgeos.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py index f05cbd2905..9cbf5ae4ac 100644 --- a/django/contrib/gis/geos/libgeos.py +++ b/django/contrib/gis/geos/libgeos.py @@ -7,7 +7,7 @@ get_pointer_arr(), and GEOM_PTR. """ import atexit, os, re, sys -from ctypes import c_char_p, string_at, Structure, CDLL, CFUNCTYPE, POINTER +from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER from django.contrib.gis.geos.error import GEOSException # NumPy supported? @@ -92,9 +92,11 @@ def get_pointer_arr(n): GeomArr = GEOM_PTR * n return GeomArr() -def geos_version(): - "Returns the string version of GEOS." - return string_at(lgeos.GEOSversion()) +# Returns the string version of the GEOS library. Have to set the restype +# explicitly to c_char_p to ensure compatibility accross 32 and 64-bit platforms. +geos_version = lgeos.GEOSversion +geos_version.argtypes = None +geos_version.restype = c_char_p # Regular expression should be able to parse version strings such as # '3.0.0rc4-CAPI-1.3.3', or '3.0.0-CAPI-1.4.1'