mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Fix signedness of various char variables to stop causing a warning under gcc 4.
This commit is contained in:
parent
55fa66dd45
commit
c9371d4a1b
3 changed files with 12 additions and 12 deletions
|
|
@ -721,7 +721,7 @@ PyEval_EvalFrame(PyFrameObject *f)
|
||||||
consts = co->co_consts;
|
consts = co->co_consts;
|
||||||
fastlocals = f->f_localsplus;
|
fastlocals = f->f_localsplus;
|
||||||
freevars = f->f_localsplus + f->f_nlocals;
|
freevars = f->f_localsplus + f->f_nlocals;
|
||||||
first_instr = PyString_AS_STRING(co->co_code);
|
first_instr = (unsigned char*) PyString_AS_STRING(co->co_code);
|
||||||
/* An explanation is in order for the next line.
|
/* An explanation is in order for the next line.
|
||||||
|
|
||||||
f->f_lasti now refers to the index of the last instruction
|
f->f_lasti now refers to the index of the last instruction
|
||||||
|
|
|
||||||
|
|
@ -662,7 +662,7 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names, PyObject *linen
|
||||||
|
|
||||||
/* Bypass optimization when the lineno table is too complex */
|
/* Bypass optimization when the lineno table is too complex */
|
||||||
assert(PyString_Check(lineno_obj));
|
assert(PyString_Check(lineno_obj));
|
||||||
lineno = PyString_AS_STRING(lineno_obj);
|
lineno = (unsigned char*)PyString_AS_STRING(lineno_obj);
|
||||||
tabsiz = PyString_GET_SIZE(lineno_obj);
|
tabsiz = PyString_GET_SIZE(lineno_obj);
|
||||||
if (memchr(lineno, 255, tabsiz) != NULL)
|
if (memchr(lineno, 255, tabsiz) != NULL)
|
||||||
goto exitUnchanged;
|
goto exitUnchanged;
|
||||||
|
|
|
||||||
|
|
@ -169,14 +169,14 @@ w_object(PyObject *v, WFILE *p)
|
||||||
}
|
}
|
||||||
else if (PyFloat_Check(v)) {
|
else if (PyFloat_Check(v)) {
|
||||||
if (p->version > 1) {
|
if (p->version > 1) {
|
||||||
char buf[8];
|
unsigned char buf[8];
|
||||||
if (_PyFloat_Pack8(PyFloat_AsDouble(v),
|
if (_PyFloat_Pack8(PyFloat_AsDouble(v),
|
||||||
buf, 1) < 0) {
|
buf, 1) < 0) {
|
||||||
p->error = 1;
|
p->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
w_byte(TYPE_BINARY_FLOAT, p);
|
w_byte(TYPE_BINARY_FLOAT, p);
|
||||||
w_string(buf, 8, p);
|
w_string((char*)buf, 8, p);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char buf[256]; /* Plenty to format any double */
|
char buf[256]; /* Plenty to format any double */
|
||||||
|
|
@ -190,20 +190,20 @@ w_object(PyObject *v, WFILE *p)
|
||||||
#ifndef WITHOUT_COMPLEX
|
#ifndef WITHOUT_COMPLEX
|
||||||
else if (PyComplex_Check(v)) {
|
else if (PyComplex_Check(v)) {
|
||||||
if (p->version > 1) {
|
if (p->version > 1) {
|
||||||
char buf[8];
|
unsigned char buf[8];
|
||||||
if (_PyFloat_Pack8(PyComplex_RealAsDouble(v),
|
if (_PyFloat_Pack8(PyComplex_RealAsDouble(v),
|
||||||
buf, 1) < 0) {
|
buf, 1) < 0) {
|
||||||
p->error = 1;
|
p->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
w_byte(TYPE_BINARY_COMPLEX, p);
|
w_byte(TYPE_BINARY_COMPLEX, p);
|
||||||
w_string(buf, 8, p);
|
w_string((char*)buf, 8, p);
|
||||||
if (_PyFloat_Pack8(PyComplex_ImagAsDouble(v),
|
if (_PyFloat_Pack8(PyComplex_ImagAsDouble(v),
|
||||||
buf, 1) < 0) {
|
buf, 1) < 0) {
|
||||||
p->error = 1;
|
p->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
w_string(buf, 8, p);
|
w_string((char*)buf, 8, p);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char buf[256]; /* Plenty to format any double */
|
char buf[256]; /* Plenty to format any double */
|
||||||
|
|
@ -556,9 +556,9 @@ r_object(RFILE *p)
|
||||||
|
|
||||||
case TYPE_BINARY_FLOAT:
|
case TYPE_BINARY_FLOAT:
|
||||||
{
|
{
|
||||||
char buf[8];
|
unsigned char buf[8];
|
||||||
double x;
|
double x;
|
||||||
if (r_string(buf, 8, p) != 8) {
|
if (r_string((char*)buf, 8, p) != 8) {
|
||||||
PyErr_SetString(PyExc_EOFError,
|
PyErr_SetString(PyExc_EOFError,
|
||||||
"EOF read where object expected");
|
"EOF read where object expected");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -600,9 +600,9 @@ r_object(RFILE *p)
|
||||||
|
|
||||||
case TYPE_BINARY_COMPLEX:
|
case TYPE_BINARY_COMPLEX:
|
||||||
{
|
{
|
||||||
char buf[8];
|
unsigned char buf[8];
|
||||||
Py_complex c;
|
Py_complex c;
|
||||||
if (r_string(buf, 8, p) != 8) {
|
if (r_string((char*)buf, 8, p) != 8) {
|
||||||
PyErr_SetString(PyExc_EOFError,
|
PyErr_SetString(PyExc_EOFError,
|
||||||
"EOF read where object expected");
|
"EOF read where object expected");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -611,7 +611,7 @@ r_object(RFILE *p)
|
||||||
if (c.real == -1.0 && PyErr_Occurred()) {
|
if (c.real == -1.0 && PyErr_Occurred()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (r_string(buf, 8, p) != 8) {
|
if (r_string((char*)buf, 8, p) != 8) {
|
||||||
PyErr_SetString(PyExc_EOFError,
|
PyErr_SetString(PyExc_EOFError,
|
||||||
"EOF read where object expected");
|
"EOF read where object expected");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue