[Thuban-commits] r2810 - in branches/WIP-pyshapelib-Unicode/thuban: . libraries/pyshapelib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 17 22:42:30 CET 2008


Author: bramz
Date: 2008-01-17 22:42:29 +0100 (Thu, 17 Jan 2008)
New Revision: 2810

Modified:
   branches/WIP-pyshapelib-Unicode/thuban/ChangeLog
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/dbflibmodule.c
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/pyshapelib_common.h
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/setup.py
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c
   branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shptreemodule.c
   branches/WIP-pyshapelib-Unicode/thuban/setup.py
Log:
fixing compiler warnings (gcc 3.3.5)


Modified: branches/WIP-pyshapelib-Unicode/thuban/ChangeLog
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/ChangeLog	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/ChangeLog	2008-01-17 21:42:29 UTC (rev 2810)
@@ -1,3 +1,7 @@
+2008-01-17   Bram de Greve <bram.degreve at bramz.net>
+
+	* setup.py: updated for pyshapelib
+
 2008-01-16   Bram de Greve <bram.degreve at bramz.net>
 
 	* Forward porting trunk (2801:2807] to WIP-pyshapelib-Unicode branch.

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/ChangeLog	2008-01-17 21:42:29 UTC (rev 2810)
@@ -1,3 +1,8 @@
+2008-01-17  Bram de Greve <bram.degreve at bramz.net>
+
+	* pyshapelib_common.h, shapelibmodule.c, dbflibmodule.c, shptreemodule.c:
+	fixed some build warnings (gcc 3.3.5)
+
 2008-01-16  Bram de Greve <bram.degreve at bramz.net>
 
 	* pyshapelib_common.h, setup.py: as shapefil.h r1.44 of cvs.maptools.org

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/dbflibmodule.c
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/dbflibmodule.c	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/dbflibmodule.c	2008-01-17 21:42:29 UTC (rev 2810)
@@ -680,7 +680,6 @@
 	char* file;
 	DBFFileObject* result;
 	DBFHandle handle = NULL;
-	int wideargument = 0;
 	PyObject* return_unicode = NULL;
 	PyObject* codecs_map = NULL;
 	char* code_page = DEFAULT_CODE_PAGE;

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/pyshapelib_common.h
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/pyshapelib_common.h	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/pyshapelib_common.h	2008-01-17 21:42:29 UTC (rev 2810)
@@ -1,120 +1,121 @@
-/* Copyright (c) 2007-2008 by Intevation GmbH
- * Authors:
- * Bram de Greve <bram.degreve at bramz.net>
- *
- * This program is free software under the LGPL (>=v2)
- * Read the file COPYING coming with pyshapelib for details.
- */
-
-#ifndef PYSHAPELIB_H
-#define PYSHAPELIB_H
-
-#include <Python.h>
-#include <structmember.h>
-#include "shapefil.h"
-#include "pyshapelib_api.h"
-
-
-/* helper to export constants (macros) to Python.
- * The constant in Python will have the same name as in C
- */
-#define PYSHAPELIB_ADD_CONSTANT(constant) PyModule_AddIntConstant(module, #constant, constant)
-
-/* helper to define the type object.
- *
- * This assumes quite a few things about different things being available and their name.
- * For example, if prefix = foo, then there should be a deallocation function called foo_dealloc.
- * See the macro itself for other examples.
- */
-#define PYSHAPELIB_DEFINE_TYPE(object, prefix, name, doc) \
-{ \
-		PyObject_HEAD_INIT(NULL) \
-		0,									/*ob_size*/ \
-		name,								/*tp_name*/ \
-		sizeof(object),						/*tp_basicsize*/ \
-		0,									/*tp_itemsize*/ \
-		(destructor) prefix ## _dealloc,	/*tp_dealloc*/ \
-		0,									/*tp_print*/ \
-		0,									/*tp_getattr*/ \
-		0,									/*tp_setattr*/ \
-		0,									/*tp_compare*/ \
-		(reprfunc) prefix ## _repr,			/*tp_repr*/ \
-		0,									/*tp_as_number*/ \
-		0,									/*tp_as_sequence*/ \
-		0,									/*tp_as_mapping*/ \
-		0,									/*tp_hash */ \
-		0,									/*tp_call*/ \
-		0,									/*tp_str*/ \
-		0,									/*tp_getattro*/ \
-		0,									/*tp_setattro*/ \
-		0,									/*tp_as_buffer*/ \
-		Py_TPFLAGS_DEFAULT,					/*tp_flags*/ \
-		doc,								/* tp_doc */ \
-		0,									/* tp_traverse */ \
-		0,									/* tp_clear */ \
-		0,									/* tp_richcompare */ \
-		0,									/* tp_weaklistoffset */ \
-		0,									/* tp_iter */ \
-		0,									/* tp_iternext */ \
-		prefix ## _methods,					/* tp_methods */ \
-		0,									/* tp_members */ \
-		prefix ## _getsetters,				/* tp_getset */ \
-		0,									/* tp_base */ \
-		0,									/* tp_dict */ \
-		0,									/* tp_descr_get */ \
-		0,									/* tp_descr_set */ \
-		0,									/* tp_dictoffset */ \
-		(initproc) prefix ## _init,			/* tp_init */ \
-		0,									/* tp_alloc */ \
-		prefix ## _new,						/* tp_new */ \
-	} \
-	/**/
-
-/* helper to add type to module.
- * Does a bit of the tedious bookkeeping for us
- */
-#define PYSHAPELIB_ADD_TYPE(type, name) \
-	type.ob_type = &PyType_Type; \
-	if (PyType_Ready(&type) >= 0) \
-	{ \
-		Py_INCREF(&type); \
-		PyModule_AddObject(module, name, (PyObject*)&type); \
-	}
-
-#define PYSHAPELIB_NO_DATA 0
-
-/* helpers to setup the shapelib API hooks correctly
- */
-#if PY_VERSION_HEX >=0x02040000
-#	define PYSHAPELIB_ATOF PyOS_ascii_atof
-#else
-#	define PYSHAPELIB_ATOF atof
-#endif
-
-#if defined(SHPAPI_UTF8_HOOKS) && defined(SHPAPI_WINDOWS)
-#	define HAVE_UTF8_HOOKS 1
-#	define PYSHAPELIB_FILENAME_ENCODING "utf-8"
-#	define PYSHAPELIB_SETUPHOOKS(pHooks)\
-		SASetupUtf8Hooks(pHooks);\
-		(pHooks)->Atof = PYSHAPELIB_ATOF
-#else
-#	define HAVE_UTF8_HOOKS 0
-#	define PYSHAPELIB_FILENAME_ENCODING Py_FileSystemDefaultEncoding
-#	define PYSHAPELIB_SETUPHOOKS(pHooks)\
-		SASetupDefaultHooks(pHooks);\
-		(pHooks)->Atof = PYSHAPELIB_ATOF
-#endif
-
-
-
-#ifndef Py_RETURN_NONE
-#	define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
-#endif
-#ifndef Py_RETURN_TRUE
-#	define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
-#endif
-#ifndef Py_RETURN_FALSE
-#	define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
-#endif
-
-#endif
\ No newline at end of file
+/* Copyright (c) 2007-2008 by Intevation GmbH
+ * Authors:
+ * Bram de Greve <bram.degreve at bramz.net>
+ *
+ * This program is free software under the LGPL (>=v2)
+ * Read the file COPYING coming with pyshapelib for details.
+ */
+
+#ifndef PYSHAPELIB_H
+#define PYSHAPELIB_H
+
+#include <Python.h>
+#include <structmember.h>
+#include "shapefil.h"
+#include "pyshapelib_api.h"
+
+
+/* helper to export constants (macros) to Python.
+ * The constant in Python will have the same name as in C
+ */
+#define PYSHAPELIB_ADD_CONSTANT(constant) PyModule_AddIntConstant(module, #constant, constant)
+
+/* helper to define the type object.
+ *
+ * This assumes quite a few things about different things being available and their name.
+ * For example, if prefix = foo, then there should be a deallocation function called foo_dealloc.
+ * See the macro itself for other examples.
+ */
+#define PYSHAPELIB_DEFINE_TYPE(object, prefix, name, doc) \
+{ \
+		PyObject_HEAD_INIT(NULL) \
+		0,									/*ob_size*/ \
+		name,								/*tp_name*/ \
+		sizeof(object),						/*tp_basicsize*/ \
+		0,									/*tp_itemsize*/ \
+		(destructor) prefix ## _dealloc,	/*tp_dealloc*/ \
+		0,									/*tp_print*/ \
+		0,									/*tp_getattr*/ \
+		0,									/*tp_setattr*/ \
+		0,									/*tp_compare*/ \
+		(reprfunc) prefix ## _repr,			/*tp_repr*/ \
+		0,									/*tp_as_number*/ \
+		0,									/*tp_as_sequence*/ \
+		0,									/*tp_as_mapping*/ \
+		0,									/*tp_hash */ \
+		0,									/*tp_call*/ \
+		0,									/*tp_str*/ \
+		0,									/*tp_getattro*/ \
+		0,									/*tp_setattro*/ \
+		0,									/*tp_as_buffer*/ \
+		Py_TPFLAGS_DEFAULT,					/*tp_flags*/ \
+		doc,								/* tp_doc */ \
+		0,									/* tp_traverse */ \
+		0,									/* tp_clear */ \
+		0,									/* tp_richcompare */ \
+		0,									/* tp_weaklistoffset */ \
+		0,									/* tp_iter */ \
+		0,									/* tp_iternext */ \
+		prefix ## _methods,					/* tp_methods */ \
+		0,									/* tp_members */ \
+		prefix ## _getsetters,				/* tp_getset */ \
+		0,									/* tp_base */ \
+		0,									/* tp_dict */ \
+		0,									/* tp_descr_get */ \
+		0,									/* tp_descr_set */ \
+		0,									/* tp_dictoffset */ \
+		(initproc) prefix ## _init,			/* tp_init */ \
+		0,									/* tp_alloc */ \
+		prefix ## _new,						/* tp_new */ \
+	} \
+	/**/
+
+/* helper to add type to module.
+ * Does a bit of the tedious bookkeeping for us
+ */
+#define PYSHAPELIB_ADD_TYPE(type, name) \
+	type.ob_type = &PyType_Type; \
+	if (PyType_Ready(&type) >= 0) \
+	{ \
+		Py_INCREF(&type); \
+		PyModule_AddObject(module, name, (PyObject*)&type); \
+	}
+
+#define PYSHAPELIB_NO_DATA 0
+
+/* helpers to setup the shapelib API hooks correctly
+ */
+#if PY_VERSION_HEX >=0x02040000
+#	define PYSHAPELIB_ATOF PyOS_ascii_atof
+#else
+#	define PYSHAPELIB_ATOF atof
+#endif
+
+#if defined(SHPAPI_UTF8_HOOKS) && defined(SHPAPI_WINDOWS)
+#	define HAVE_UTF8_HOOKS 1
+#	define PYSHAPELIB_FILENAME_ENCODING "utf-8"
+#	define PYSHAPELIB_SETUPHOOKS(pHooks)\
+		SASetupUtf8Hooks(pHooks);\
+		(pHooks)->Atof = PYSHAPELIB_ATOF
+#else
+#	define HAVE_UTF8_HOOKS 0
+#	define PYSHAPELIB_FILENAME_ENCODING Py_FileSystemDefaultEncoding
+#	define PYSHAPELIB_SETUPHOOKS(pHooks)\
+		SASetupDefaultHooks(pHooks);\
+		(pHooks)->Atof = PYSHAPELIB_ATOF
+#endif
+
+
+
+#ifndef Py_RETURN_NONE
+#	define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#endif
+#ifndef Py_RETURN_TRUE
+#	define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
+#endif
+#ifndef Py_RETURN_FALSE
+#	define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
+#endif
+
+#endif
+

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/setup.py
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/setup.py	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/setup.py	2008-01-17 21:42:29 UTC (rev 2810)
@@ -31,7 +31,7 @@
 	print >>sys.stderr, "no shapelib directory found"
 	sys.exit(1)
 
-def dbf_macros():
+def determine_macros():
 	"""Return the macros to define when compiling the dbflib wrapper.
 
 	The returned list specifies following macros:
@@ -55,7 +55,8 @@
 	
 	return [
 		("HAVE_UPDATE_HEADER", have("DBFUpdateHeader")),
-		("HAVE_CODE_PAGE", have("DBFGetCodePage"))]
+		("HAVE_CODE_PAGE", have("DBFGetCodePage")),
+		("DISABLE_CVSID", "1")]
 
 
 
@@ -68,7 +69,7 @@
 	return filter(os.path.exists, candidates)
 
 
-
+macros = determine_macros()
 sahooks_files = search_sahooks_files()
 
 extensions = [Extension("shapelib",
@@ -76,16 +77,18 @@
 						shp_dir + "/shpopen.c",
 						shp_dir + "/shptree.c"]
 						+ sahooks_files,
-						include_dirs = [shp_dir]),
+						include_dirs = [shp_dir],
+						define_macros = macros),
 			Extension("shptree",
 						["shptreemodule.c"],
-						include_dirs = [shp_dir]),
+						include_dirs = [shp_dir],
+						define_macros = macros),
 			Extension("dbflib",
 						["dbflibmodule.c",
 						shp_dir + "/dbfopen.c"]
 						+ sahooks_files,
 						include_dirs = [shp_dir],
-						define_macros =dbf_macros())]
+						define_macros = macros)]
 
 setup(name = "pyshapelib",
 	version = "0.4",

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shapelibmodule.c	2008-01-17 21:42:29 UTC (rev 2810)
@@ -103,7 +103,7 @@
 	int* part_starts = NULL;
 	int* part_types = NULL;
 	
-	PyObject* part;
+	PyObject* part = NULL;
 	int vertex_type;
 	int has_z;
 	int has_m;
@@ -701,7 +701,6 @@
 	int type;
 	ShapeFileObject* result;
 	SHPHandle handle = NULL;
-	int wideargument = 0;
 
 	if (!PyArg_ParseTuple(args, "eti:create", PYSHAPELIB_FILENAME_ENCODING, &file, &type)) return NULL;
 	

Modified: branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shptreemodule.c
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shptreemodule.c	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/libraries/pyshapelib/shptreemodule.c	2008-01-17 21:42:29 UTC (rev 2810)
@@ -50,7 +50,7 @@
 shptree_repr(SHPTreeObject * self)
 {
     char buf[1000];
-    sprintf(buf, "<SHPTree at %xul>", (unsigned long)self);
+    sprintf(buf, "<SHPTree at %p>", self);
     return PyString_FromString(buf);
 }
 

Modified: branches/WIP-pyshapelib-Unicode/thuban/setup.py
===================================================================
--- branches/WIP-pyshapelib-Unicode/thuban/setup.py	2008-01-16 20:27:53 UTC (rev 2809)
+++ branches/WIP-pyshapelib-Unicode/thuban/setup.py	2008-01-17 21:42:29 UTC (rev 2810)
@@ -281,7 +281,8 @@
     
     return [
         ("HAVE_UPDATE_HEADER", have("DBFUpdateHeader")),
-        ("HAVE_CODE_PAGE", have("DBFGetCodePage"))]
+        ("HAVE_CODE_PAGE", have("DBFGetCodePage")),
+	("DISABLE_CVSID", "1")]
 
 def search_sahooks_files():
     candidates = [shp_dir + "/safileio.c"]
@@ -295,10 +296,12 @@
                              shp_dir + "/shpopen.c",
                              shp_dir + "/shptree.c"]
                             + sahooks_files,
-                            include_dirs = [shp_dir]))
+                            include_dirs = [shp_dir],
+                            define_macros = shapelib_macros))
 extensions.append(Extension("Lib.shptree",
                             [ext_dir + "/pyshapelib/shptreemodule.c"],
-                            include_dirs = [shp_dir]))
+                            include_dirs = [shp_dir],
+                            define_macros = shapelib_macros))
 extensions.append(Extension("Lib.dbflib",
                             [ext_dir + "/pyshapelib/dbflibmodule.c",
                              shp_dir + "/dbfopen.c"]



More information about the Thuban-commits mailing list