Rev 1511: Attempt to support other sizes for svn_filesize_t and apr_size_t. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Sat Aug 2 00:58:43 BST 2008


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

------------------------------------------------------------
revno: 1511
revision-id: jelmer at samba.org-20080801235839-r2i3toew7cvu93l2
parent: jelmer at samba.org-20080801213954-ei7vahx4tomdozj4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-02 01:58:39 +0200
message:
  Attempt to support other sizes for svn_filesize_t and apr_size_t.
modified:
  editor.c                       editor.c-20080602191336-frj7az1sdk13o1tw-1
=== modified file 'editor.c'
--- a/editor.c	2008-08-01 21:06:43 +0000
+++ b/editor.c	2008-08-01 23:58:39 +0000
@@ -53,6 +53,22 @@
 	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
+#error "Unable to determine PyArg_Parse format for size_t"
+#endif
+
+#if SIZEOF_LONG == 8
+#define SVN_FILESIZE_T_PYFMT "k"
+#elif SIZEOF_LONG_LONG == 8
+#define SVN_FILESIZE_T_PYFMT "K"
+#else
+#error "Unable to determine PyArg_Parse format for size_t"
+#endif
+
 static PyObject *txdelta_call(PyObject *self, PyObject *args, PyObject *kwargs)
 {
 	char *kwnames[] = { "window", NULL };
@@ -72,7 +88,7 @@
 		Py_RETURN_NONE;
 	}
 
-	if (!PyArg_ParseTuple(py_window, "LIIiOO", &window.sview_offset, &window.sview_len, 
+	if (!PyArg_ParseTuple(py_window, SVN_FILESIZE_T_PYFMT SIZE_T_PYFMT SIZE_T_PYFMT "iOO", &window.sview_offset, &window.sview_len, 
 											&window.tview_len, &window.src_ops, &py_ops, &py_new_data))
 		return NULL;
 
@@ -94,7 +110,9 @@
 	window.ops = ops = malloc(sizeof(svn_txdelta_op_t) * window.num_ops);
 
 	for (i = 0; i < window.num_ops; i++) {
-		if (!PyArg_ParseTuple(PyList_GetItem(py_ops, i), "iII", &ops[i].action_code, &ops[i].offset, &ops[i].length)) {
+		PyObject *windowitem = PyList_GetItem(py_ops, i);
+		if (!PyArg_ParseTuple(windowitem, "i" SIZE_T_PYFMT SIZE_T_PYFMT, &ops[i].action_code, 
+							  &ops[i].offset, &ops[i].length)) {
 			free(ops);
 			return NULL;
 		}




More information about the bazaar-commits mailing list