Rev 1513: Fix use on 64-bit platforms. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Sat Aug 2 01:14:44 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1513
revision-id: jelmer at samba.org-20080802001443-l5ap9wn1av92nbxp
parent: jelmer at samba.org-20080802001159-na6ibzamszgnyo6p
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-02 02:14:43 +0200
message:
  Fix use on 64-bit platforms.
modified:
  editor.c                       editor.c-20080602191336-frj7az1sdk13o1tw-1
=== modified file 'editor.c'
--- a/editor.c	2008-08-01 23:58:39 +0000
+++ b/editor.c	2008-08-02 00:14:43 +0000
@@ -53,14 +53,12 @@
 	PyObject_Del(self);
 }
 
-#if SIZEOF_SIZE_T == SIZEOF_LONG
-#define SIZE_T_PYFMT "k"
-#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
-#define SIZE_T_PYFMT "K"
-#else
+/* paranoia check */
+#if defined(SIZEOF_SIZE_T) && SIZEOF_SIZE_T != SIZEOF_LONG
 #error "Unable to determine PyArg_Parse format for size_t"
 #endif
 
+/* svn_filesize_t is always 64 bits */
 #if SIZEOF_LONG == 8
 #define SVN_FILESIZE_T_PYFMT "k"
 #elif SIZEOF_LONG_LONG == 8
@@ -88,7 +86,7 @@
 		Py_RETURN_NONE;
 	}
 
-	if (!PyArg_ParseTuple(py_window, SVN_FILESIZE_T_PYFMT SIZE_T_PYFMT SIZE_T_PYFMT "iOO", &window.sview_offset, &window.sview_len, 
+	if (!PyArg_ParseTuple(py_window, SVN_FILESIZE_T_PYFMT "kkiOO", &window.sview_offset, &window.sview_len, 
 											&window.tview_len, &window.src_ops, &py_ops, &py_new_data))
 		return NULL;
 
@@ -111,7 +109,7 @@
 
 	for (i = 0; i < window.num_ops; i++) {
 		PyObject *windowitem = PyList_GetItem(py_ops, i);
-		if (!PyArg_ParseTuple(windowitem, "i" SIZE_T_PYFMT SIZE_T_PYFMT, &ops[i].action_code, 
+		if (!PyArg_ParseTuple(windowitem, "ikk", &ops[i].action_code, 
 							  &ops[i].offset, &ops[i].length)) {
 			free(ops);
 			return NULL;




More information about the bazaar-commits mailing list