[PATCH] base85: use z modifier to print Py_ssize_t
David Soria Parra
dsp at php.net
Mon Jun 4 02:15:06 CDT 2012
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1338794040 -7200
# Node ID 5d6ccf796a9410cbef419478e5bca67722f214ea
# Parent 0a0cf3f26938ff7a084f2dcc9e59152ac6060e1e
base85: use z modifier to print Py_ssize_t
Python converts to z modifiert to PY_SIZE_FORMAT_T internally. Using the
z modifier is the right way to print Py_ssize_t arguments. This squelches a
conversion warning.
diff --git a/mercurial/base85.c b/mercurial/base85.c
--- a/mercurial/base85.c
+++ b/mercurial/base85.c
@@ -111,7 +111,7 @@
if (c < 0)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 character at position %d", i);
+ "bad base85 character at position %zd", i);
acc = acc * 85 + c;
}
if (i++ < len)
@@ -120,13 +120,13 @@
if (c < 0)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 character at position %d", i);
+ "bad base85 character at position %zd", i);
/* overflow detection: 0xffffffff == "|NsC0",
* "|NsC" == 0x03030303 */
if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 sequence at position %d", i);
+ "bad base85 sequence at position %zd", i);
acc += c;
}
More information about the Mercurial-devel
mailing list