summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2008-02-08 14:42:37 +0000
committerJustin Bronn <jbronn@gmail.com>2008-02-08 14:42:37 +0000
commitead0dad73514f706fdd7943eb7a5690e86fa8eaf (patch)
tree62eca5fce9691938c079196e415064314e5f48f3
parent06f2ddeb51517c6754ccd5a69d00f5b29cd899c3 (diff)
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
-rw-r--r--django/contrib/gis/geos/libgeos.py10
1 files 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'