summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstringio.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-07-27 22:38:58 +0100
committerDamien George <damien.p.george@gmail.com>2014-07-27 22:38:58 +0100
commitadf0f2ae1a3debf8465ece7e065ddba2d4032e8c (patch)
tree090c7544536b130b47e30f8834d7450272dfb54a /py/objstringio.c
parent05c255f039b5c0fbdcb0754748fd5d36135acfd9 (diff)
downloadmicropython-adf0f2ae1a3debf8465ece7e065ddba2d4032e8c.tar.gz
micropython-adf0f2ae1a3debf8465ece7e065ddba2d4032e8c.zip
py: Change stream protocol API: fns return uint; is_text for text.
Diffstat (limited to 'py/objstringio.c')
-rw-r--r--py/objstringio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/objstringio.c b/py/objstringio.c
index bffdf2cf79..70f0c68dd4 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -51,7 +51,7 @@ STATIC void stringio_print(void (*print)(void *env, const char *fmt, ...), void
print(env, self->base.type == &mp_type_stringio ? "<io.StringIO 0x%x>" : "<io.BytesIO 0x%x>", self->vstr);
}
-STATIC mp_int_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+STATIC mp_uint_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_stringio_t *o = o_in;
mp_uint_t remaining = o->vstr->len - o->pos;
if (size > remaining) {
@@ -62,7 +62,7 @@ STATIC mp_int_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *err
return size;
}
-STATIC mp_int_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+STATIC mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_stringio_t *o = o_in;
mp_uint_t remaining = o->vstr->alloc - o->pos;
if (size > remaining) {
@@ -137,12 +137,12 @@ STATIC MP_DEFINE_CONST_DICT(stringio_locals_dict, stringio_locals_dict_table);
STATIC const mp_stream_p_t stringio_stream_p = {
.read = stringio_read,
.write = stringio_write,
+ .is_text = true,
};
STATIC const mp_stream_p_t bytesio_stream_p = {
.read = stringio_read,
.write = stringio_write,
- .is_bytes = true,
};
const mp_obj_type_t mp_type_stringio = {