##// 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 37 unsigned int acc, val, ch;
38 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 41 return NULL;
42 42
43 43 if (pad)
@@ -84,7 +84,7 b' static PyObject *b85decode(PyObject *sel'
84 84 int c;
85 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 88 return NULL;
89 89
90 90 olen = len / 5 * 4;
@@ -70,7 +70,8 b' static PyObject *bdiff(PyObject *self, P'
70 70
71 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 75 return NULL;
75 76
76 77 if (la > UINT_MAX || lb > UINT_MAX) {
@@ -196,7 +197,7 b' static PyObject *splitnewlines(PyObject '
196 197 Py_ssize_t nelts = 0, size, i, start = 0;
197 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 201 goto abort;
201 202 }
202 203 if (!size) {
@@ -132,7 +132,8 b' PyObject *isasciistr(PyObject *self, PyO'
132 132 {
133 133 const char *buf;
134 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 137 return NULL;
137 138 i = 0;
138 139 /* char array in PyStringObject should be at least 4-byte aligned */
@@ -134,7 +134,7 b' static PyObject *patchedsize(PyObject *s'
134 134 Py_ssize_t patchlen;
135 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 138 return NULL;
139 139
140 140 while (pos >= 0 && pos < patchlen) {
@@ -758,7 +758,7 b' bail:'
758 758 static PyObject *setprocname(PyObject *self, PyObject *args)
759 759 {
760 760 const char *name = NULL;
761 if (!PyArg_ParseTuple(args, "s", &name))
761 if (!PyArg_ParseTuple(args, PY23("s", "y"), &name))
762 762 return NULL;
763 763
764 764 #if defined(SETPROCNAME_USE_SETPROCTITLE)
@@ -1105,7 +1105,7 b' static PyObject *getfstype(PyObject *sel'
1105 1105 const char *path = NULL;
1106 1106 struct statfs buf;
1107 1107 int r;
1108 if (!PyArg_ParseTuple(args, "s", &path))
1108 if (!PyArg_ParseTuple(args, PY23("s", "y"), &path))
1109 1109 return NULL;
1110 1110
1111 1111 memset(&buf, 0, sizeof(buf));
@@ -1123,7 +1123,7 b' static PyObject *getfsmountpoint(PyObjec'
1123 1123 const char *path = NULL;
1124 1124 struct statfs buf;
1125 1125 int r;
1126 if (!PyArg_ParseTuple(args, "s", &path))
1126 if (!PyArg_ParseTuple(args, PY23("s", "y"), &path))
1127 1127 return NULL;
1128 1128
1129 1129 memset(&buf, 0, sizeof(buf));
@@ -1164,7 +1164,8 b' static PyObject *listdir(PyObject *self,'
1164 1164
1165 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 1169 kwlist, &path, &plen, &statobj, &skipobj))
1169 1170 return NULL;
1170 1171
@@ -1197,7 +1198,9 b' static PyObject *posixfile(PyObject *sel'
1197 1198 int plus;
1198 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 1204 Py_FileSystemDefaultEncoding,
1202 1205 &name, &mode, &bufsize))
1203 1206 return NULL;
@@ -48,8 +48,9 b' static PyObject *parse_manifest(PyObject'
48 48 char *str, *start, *end;
49 49 int len;
50 50
51 if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest", &PyDict_Type,
52 &mfdict, &PyDict_Type, &fdict, &str, &len))
51 if (!PyArg_ParseTuple(
52 args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"),
53 &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len))
53 54 goto quit;
54 55
55 56 start = str;
@@ -241,8 +242,9 b' static PyObject *parse_dirstate(PyObject'
241 242 unsigned int flen, len, pos = 40;
242 243 int readlen;
243 244
244 if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate", &PyDict_Type,
245 &dmap, &PyDict_Type, &cmap, &str, &readlen))
245 if (!PyArg_ParseTuple(
246 args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"),
247 &PyDict_Type, &dmap, &PyDict_Type, &cmap, &str, &readlen))
246 248 goto quit;
247 249
248 250 len = readlen;
@@ -645,7 +647,8 b' static PyObject *fm1readmarkers(PyObject'
645 647 Py_ssize_t offset, stop;
646 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 652 return NULL;
650 653 }
651 654 dataend = data + datalen;
@@ -512,7 +512,8 b' PyObject *lowerencode(PyObject *self, Py'
512 512 Py_ssize_t len, newlen;
513 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 517 return NULL;
517 518
518 519 newlen = _lowerencode(NULL, 0, path, len);
@@ -1243,7 +1243,7 b' static PyObject *index_partialmatch(inde'
1243 1243 char *node;
1244 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 1247 return NULL;
1248 1248
1249 1249 if (nodelen < 4) {
General Comments 0
You need to be logged in to leave comments. Login now