summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-17 21:31:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-17 21:31:25 (GMT)
commit7d7e7756d9e5c5ea3ab33f66925e28b5dcb5169c (patch)
tree6c6872bd1a87b26ab9cebf871b3e50534a08af68 /Modules/_io/textio.c
parent1b1fe97e9505e605201a1d27a6d6a90898a8303d (diff)
downloadcpython-7d7e7756d9e5c5ea3ab33f66925e28b5dcb5169c.zip
cpython-7d7e7756d9e5c5ea3ab33f66925e28b5dcb5169c.tar.gz
cpython-7d7e7756d9e5c5ea3ab33f66925e28b5dcb5169c.tar.bz2
Issue #10310: Use "unsigned int field:1" instead of "signed int field:1" in a
private structure of the _io module to fix a compiler warning (overflow when assigning the value 1). Fix also a cast in incrementalnewlinedecoder_setstate(). Patch written by Hallvard B Furuseth.
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r--Modules/_io/textio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 140688f..aed5b2d 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -224,8 +224,8 @@ typedef struct {
PyObject_HEAD
PyObject *decoder;
PyObject *errors;
- signed int pendingcr: 1;
- signed int translate: 1;
+ unsigned int pendingcr: 1;
+ unsigned int translate: 1;
unsigned int seennl: 3;
} nldecoder_object;
@@ -546,7 +546,7 @@ incrementalnewlinedecoder_setstate(nldecoder_object *self, PyObject *state)
if (!PyArg_Parse(state, "(OK)", &buffer, &flag))
return NULL;
- self->pendingcr = (int) flag & 1;
+ self->pendingcr = (int) (flag & 1);
flag >>= 1;
if (self->decoder != Py_None)