#4807: Remove a wrong usage of wsprintf in the winreg module
("windows sprintf", different than swprintf)
Needed for the windows CE port.
diff --git a/PC/_winreg.c b/PC/_winreg.c
index 74d3343..0cb516a 100644
--- a/PC/_winreg.c
+++ b/PC/_winreg.c
@@ -410,21 +410,17 @@
static int
PyHKEY_printFunc(PyObject *ob, FILE *fp, int flags)
{
- PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
- char resBuf[160];
- wsprintf(resBuf, "<PyHKEY at %p (%p)>",
- ob, pyhkey->hkey);
- fputs(resBuf, fp);
- return 0;
+ PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
+ fprintf(fp, "<PyHKEY at %p (%p)>",
+ ob, pyhkey->hkey);
+ return 0;
}
static PyObject *
PyHKEY_strFunc(PyObject *ob)
{
- PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
- char resBuf[160];
- wsprintf(resBuf, "<PyHKEY:%p>", pyhkey->hkey);
- return PyString_FromString(resBuf);
+ PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
+ return PyString_FromFormat("<PyHKEY:%p>", pyhkey->hkey);
}
static int