##// END OF EJS Templates
py3: bulk-replace 'const char*' format specifier passed to PyArg_ParseTuple*()...
Yuya Nishihara -
r36638:186c6df3 default
parent child Browse files
Show More
@@ -37,7 +37,7 b' static PyObject *b85encode(PyObject *sel'
37 unsigned int acc, val, ch;
37 unsigned int acc, val, ch;
38 int pad = 0;
38 int pad = 0;
39
39
40 if (!PyArg_ParseTuple(args, "s#|i", &text, &len, &pad))
40 if (!PyArg_ParseTuple(args, PY23("s#|i", "y#|i"), &text, &len, &pad))
41 return NULL;
41 return NULL;
42
42
43 if (pad)
43 if (pad)
@@ -84,7 +84,7 b' static PyObject *b85decode(PyObject *sel'
84 int c;
84 int c;
85 unsigned int acc;
85 unsigned int acc;
86
86
87 if (!PyArg_ParseTuple(args, "s#", &text, &len))
87 if (!PyArg_ParseTuple(args, PY23("s#", "y#"), &text, &len))
88 return NULL;
88 return NULL;
89
89
90 olen = len / 5 * 4;
90 olen = len / 5 * 4;
@@ -70,7 +70,8 b' static PyObject *bdiff(PyObject *self, P'
70
70
71 l.next = NULL;
71 l.next = NULL;
72
72
73 if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb))
73 if (!PyArg_ParseTuple(args, PY23("s#s#:bdiff", "y#y#:bdiff"), &sa, &la,
74 &sb, &lb))
74 return NULL;
75 return NULL;
75
76
76 if (la > UINT_MAX || lb > UINT_MAX) {
77 if (la > UINT_MAX || lb > UINT_MAX) {
@@ -196,7 +197,7 b' static PyObject *splitnewlines(PyObject '
196 Py_ssize_t nelts = 0, size, i, start = 0;
197 Py_ssize_t nelts = 0, size, i, start = 0;
197 PyObject *result = NULL;
198 PyObject *result = NULL;
198
199
199 if (!PyArg_ParseTuple(args, "s#", &text, &size)) {
200 if (!PyArg_ParseTuple(args, PY23("s#", "y#"), &text, &size)) {
200 goto abort;
201 goto abort;
201 }
202 }
202 if (!size) {
203 if (!size) {
@@ -132,7 +132,8 b' PyObject *isasciistr(PyObject *self, PyO'
132 {
132 {
133 const char *buf;
133 const char *buf;
134 Py_ssize_t i, len;
134 Py_ssize_t i, len;
135 if (!PyArg_ParseTuple(args, "s#:isasciistr", &buf, &len))
135 if (!PyArg_ParseTuple(args, PY23("s#:isasciistr", "y#:isasciistr"),
136 &buf, &len))
136 return NULL;
137 return NULL;
137 i = 0;
138 i = 0;
138 /* char array in PyStringObject should be at least 4-byte aligned */
139 /* char array in PyStringObject should be at least 4-byte aligned */
@@ -134,7 +134,7 b' static PyObject *patchedsize(PyObject *s'
134 Py_ssize_t patchlen;
134 Py_ssize_t patchlen;
135 char *bin;
135 char *bin;
136
136
137 if (!PyArg_ParseTuple(args, "ls#", &orig, &bin, &patchlen))
137 if (!PyArg_ParseTuple(args, PY23("ls#", "ly#"), &orig, &bin, &patchlen))
138 return NULL;
138 return NULL;
139
139
140 while (pos >= 0 && pos < patchlen) {
140 while (pos >= 0 && pos < patchlen) {
@@ -758,7 +758,7 b' bail:'
758 static PyObject *setprocname(PyObject *self, PyObject *args)
758 static PyObject *setprocname(PyObject *self, PyObject *args)
759 {
759 {
760 const char *name = NULL;
760 const char *name = NULL;
761 if (!PyArg_ParseTuple(args, "s", &name))
761 if (!PyArg_ParseTuple(args, PY23("s", "y"), &name))
762 return NULL;
762 return NULL;
763
763
764 #if defined(SETPROCNAME_USE_SETPROCTITLE)
764 #if defined(SETPROCNAME_USE_SETPROCTITLE)
@@ -1105,7 +1105,7 b' static PyObject *getfstype(PyObject *sel'
1105 const char *path = NULL;
1105 const char *path = NULL;
1106 struct statfs buf;
1106 struct statfs buf;
1107 int r;
1107 int r;
1108 if (!PyArg_ParseTuple(args, "s", &path))
1108 if (!PyArg_ParseTuple(args, PY23("s", "y"), &path))
1109 return NULL;
1109 return NULL;
1110
1110
1111 memset(&buf, 0, sizeof(buf));
1111 memset(&buf, 0, sizeof(buf));
@@ -1123,7 +1123,7 b' static PyObject *getfsmountpoint(PyObjec'
1123 const char *path = NULL;
1123 const char *path = NULL;
1124 struct statfs buf;
1124 struct statfs buf;
1125 int r;
1125 int r;
1126 if (!PyArg_ParseTuple(args, "s", &path))
1126 if (!PyArg_ParseTuple(args, PY23("s", "y"), &path))
1127 return NULL;
1127 return NULL;
1128
1128
1129 memset(&buf, 0, sizeof(buf));
1129 memset(&buf, 0, sizeof(buf));
@@ -1164,7 +1164,8 b' static PyObject *listdir(PyObject *self,'
1164
1164
1165 static char *kwlist[] = {"path", "stat", "skip", NULL};
1165 static char *kwlist[] = {"path", "stat", "skip", NULL};
1166
1166
1167 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|OO:listdir",
1167 if (!PyArg_ParseTupleAndKeywords(args, kwargs, PY23("s#|OO:listdir",
1168 "y#|OO:listdir"),
1168 kwlist, &path, &plen, &statobj, &skipobj))
1169 kwlist, &path, &plen, &statobj, &skipobj))
1169 return NULL;
1170 return NULL;
1170
1171
@@ -1197,7 +1198,9 b' static PyObject *posixfile(PyObject *sel'
1197 int plus;
1198 int plus;
1198 FILE *fp;
1199 FILE *fp;
1199
1200
1200 if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:posixfile", kwlist,
1201 if (!PyArg_ParseTupleAndKeywords(args, kwds, PY23("et|si:posixfile",
1202 "et|yi:posixfile"),
1203 kwlist,
1201 Py_FileSystemDefaultEncoding,
1204 Py_FileSystemDefaultEncoding,
1202 &name, &mode, &bufsize))
1205 &name, &mode, &bufsize))
1203 return NULL;
1206 return NULL;
@@ -48,8 +48,9 b' static PyObject *parse_manifest(PyObject'
48 char *str, *start, *end;
48 char *str, *start, *end;
49 int len;
49 int len;
50
50
51 if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest", &PyDict_Type,
51 if (!PyArg_ParseTuple(
52 &mfdict, &PyDict_Type, &fdict, &str, &len))
52 args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"),
53 &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len))
53 goto quit;
54 goto quit;
54
55
55 start = str;
56 start = str;
@@ -241,8 +242,9 b' static PyObject *parse_dirstate(PyObject'
241 unsigned int flen, len, pos = 40;
242 unsigned int flen, len, pos = 40;
242 int readlen;
243 int readlen;
243
244
244 if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate", &PyDict_Type,
245 if (!PyArg_ParseTuple(
245 &dmap, &PyDict_Type, &cmap, &str, &readlen))
246 args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"),
247 &PyDict_Type, &dmap, &PyDict_Type, &cmap, &str, &readlen))
246 goto quit;
248 goto quit;
247
249
248 len = readlen;
250 len = readlen;
@@ -645,7 +647,8 b' static PyObject *fm1readmarkers(PyObject'
645 Py_ssize_t offset, stop;
647 Py_ssize_t offset, stop;
646 PyObject *markers = NULL;
648 PyObject *markers = NULL;
647
649
648 if (!PyArg_ParseTuple(args, "s#nn", &data, &datalen, &offset, &stop)) {
650 if (!PyArg_ParseTuple(args, PY23("s#nn", "y#nn"), &data, &datalen,
651 &offset, &stop)) {
649 return NULL;
652 return NULL;
650 }
653 }
651 dataend = data + datalen;
654 dataend = data + datalen;
@@ -512,7 +512,8 b' PyObject *lowerencode(PyObject *self, Py'
512 Py_ssize_t len, newlen;
512 Py_ssize_t len, newlen;
513 PyObject *ret;
513 PyObject *ret;
514
514
515 if (!PyArg_ParseTuple(args, "s#:lowerencode", &path, &len))
515 if (!PyArg_ParseTuple(args, PY23("s#:lowerencode", "y#:lowerencode"),
516 &path, &len))
516 return NULL;
517 return NULL;
517
518
518 newlen = _lowerencode(NULL, 0, path, len);
519 newlen = _lowerencode(NULL, 0, path, len);
@@ -1243,7 +1243,7 b' static PyObject *index_partialmatch(inde'
1243 char *node;
1243 char *node;
1244 int rev, i;
1244 int rev, i;
1245
1245
1246 if (!PyArg_ParseTuple(args, "s#", &node, &nodelen))
1246 if (!PyArg_ParseTuple(args, PY23("s#", "y#"), &node, &nodelen))
1247 return NULL;
1247 return NULL;
1248
1248
1249 if (nodelen < 4) {
1249 if (nodelen < 4) {
General Comments 0
You need to be logged in to leave comments. Login now