diff --git a/mercurial/base85.c b/mercurial/base85.c
index cda5402b17397b88bd02f502bd5277bbd0cf1895_bWVyY3VyaWFsL2Jhc2U4NS5j..19a915d43a68c5367dbb3d90069a56afef234dec_bWVyY3VyaWFsL2Jhc2U4NS5j 100644
--- a/mercurial/base85.c
+++ b/mercurial/base85.c
@@ -111,7 +111,8 @@
 			if (c < 0)
 				return PyErr_Format(
 					PyExc_ValueError,
-					"bad base85 character at position %d", i);
+					"bad base85 character at position %d",
+					(int)i);
 			acc = acc * 85 + c;
 		}
 		if (i++ < len)
@@ -120,9 +121,10 @@
 			if (c < 0)
 				return PyErr_Format(
 					PyExc_ValueError,
-					"bad base85 character at position %d", i);
+					"bad base85 character at position %d",
+					(int)i);
 			/* overflow detection: 0xffffffff == "|NsC0",
 			 * "|NsC" == 0x03030303 */
 			if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c)
 				return PyErr_Format(
 					PyExc_ValueError,
@@ -124,9 +126,10 @@
 			/* 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 %d",
+					(int)i);
 			acc += c;
 		}