1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

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
This commit is contained in:
Justin Bronn 2008-02-08 14:42:37 +00:00
parent 06f2ddeb51
commit ead0dad735

View File

@ -7,7 +7,7 @@
get_pointer_arr(), and GEOM_PTR. get_pointer_arr(), and GEOM_PTR.
""" """
import atexit, os, re, sys 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 from django.contrib.gis.geos.error import GEOSException
# NumPy supported? # NumPy supported?
@ -92,9 +92,11 @@ def get_pointer_arr(n):
GeomArr = GEOM_PTR * n GeomArr = GEOM_PTR * n
return GeomArr() return GeomArr()
def geos_version(): # Returns the string version of the GEOS library. Have to set the restype
"Returns the string version of GEOS." # explicitly to c_char_p to ensure compatibility accross 32 and 64-bit platforms.
return string_at(lgeos.GEOSversion()) 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 # 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' # '3.0.0rc4-CAPI-1.3.3', or '3.0.0-CAPI-1.4.1'