mirror of https://github.com/python/cpython.git
Trent Mick: familiar simple Win64 patches
This commit is contained in:
parent
0ed1148b75
commit
6da3434e03
|
@ -86,7 +86,7 @@ char *
|
|||
PyOS_StdioReadline(prompt)
|
||||
char *prompt;
|
||||
{
|
||||
int n;
|
||||
size_t n;
|
||||
char *p;
|
||||
n = 100;
|
||||
if ((p = PyMem_MALLOC(n)) == NULL)
|
||||
|
@ -95,7 +95,7 @@ PyOS_StdioReadline(prompt)
|
|||
if (prompt)
|
||||
fprintf(stderr, "%s", prompt);
|
||||
fflush(stderr);
|
||||
switch (my_fgets(p, n, stdin)) {
|
||||
switch (my_fgets(p, (int)n, stdin)) {
|
||||
case 0: /* Normal case */
|
||||
break;
|
||||
case 1: /* Interrupt */
|
||||
|
@ -116,11 +116,14 @@ PyOS_StdioReadline(prompt)
|
|||
#endif
|
||||
n = strlen(p);
|
||||
while (n > 0 && p[n-1] != '\n') {
|
||||
int incr = n+2;
|
||||
size_t incr = n+2;
|
||||
p = PyMem_REALLOC(p, n + incr);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
if (my_fgets(p+n, incr, stdin) != 0)
|
||||
if (incr > INT_MAX) {
|
||||
PyErr_SetString(PyExc_OverflowError, "input line too long");
|
||||
}
|
||||
if (my_fgets(p+n, (int)incr, stdin) != 0)
|
||||
break;
|
||||
n += strlen(p+n);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ parsetok(tok, g, start, err_ret)
|
|||
for (;;) {
|
||||
char *a, *b;
|
||||
int type;
|
||||
int len;
|
||||
size_t len;
|
||||
char *str;
|
||||
|
||||
type = PyTokenizer_Get(tok, &a, &b);
|
||||
|
@ -184,7 +184,7 @@ parsetok(tok, g, start, err_ret)
|
|||
err_ret->lineno = tok->lineno;
|
||||
err_ret->offset = tok->cur - tok->buf;
|
||||
if (tok->buf != NULL) {
|
||||
int len = tok->inp - tok->buf;
|
||||
size_t len = tok->inp - tok->buf;
|
||||
err_ret->text = PyMem_NEW(char, len + 1);
|
||||
if (err_ret->text != NULL) {
|
||||
if (len > 0)
|
||||
|
|
|
@ -127,7 +127,7 @@ getgrammar(filename)
|
|||
fprintf(stderr, "Parsing error %d, line %d.\n",
|
||||
err.error, err.lineno);
|
||||
if (err.text != NULL) {
|
||||
int i;
|
||||
size_t i;
|
||||
fprintf(stderr, "%s", err.text);
|
||||
i = strlen(err.text);
|
||||
if (i == 0 || err.text[i-1] != '\n')
|
||||
|
@ -195,7 +195,7 @@ char *
|
|||
PyOS_Readline(prompt)
|
||||
char *prompt;
|
||||
{
|
||||
int n = 1000;
|
||||
size_t n = 1000;
|
||||
char *p = PyMem_MALLOC(n);
|
||||
char *q;
|
||||
if (p == NULL)
|
||||
|
|
|
@ -223,9 +223,9 @@ tok_nextc(tok)
|
|||
tok->done = E_EOF;
|
||||
}
|
||||
else if (tok->start != NULL) {
|
||||
int start = tok->start - tok->buf;
|
||||
int oldlen = tok->cur - tok->buf;
|
||||
int newlen = oldlen + strlen(new);
|
||||
size_t start = tok->start - tok->buf;
|
||||
size_t oldlen = tok->cur - tok->buf;
|
||||
size_t newlen = oldlen + strlen(new);
|
||||
char *buf = tok->buf;
|
||||
PyMem_RESIZE(buf, char, newlen+1);
|
||||
tok->lineno++;
|
||||
|
|
Loading…
Reference in New Issue