py/stream: Fix stupid thinko with variable naming/shadowing.
This commit is contained in:
parent
87c783b454
commit
53ad5edc01
|
@ -211,16 +211,16 @@ void mp_stream_write_adaptor(void *self, const char *buf, size_t len) {
|
||||||
// Works only with blocking streams
|
// Works only with blocking streams
|
||||||
mp_uint_t mp_stream_writeall(mp_obj_t stream, const byte *buf, mp_uint_t size, int *errcode) {
|
mp_uint_t mp_stream_writeall(mp_obj_t stream, const byte *buf, mp_uint_t size, int *errcode) {
|
||||||
mp_obj_base_t* s = (mp_obj_base_t*)MP_OBJ_TO_PTR(stream);
|
mp_obj_base_t* s = (mp_obj_base_t*)MP_OBJ_TO_PTR(stream);
|
||||||
mp_uint_t sz = size;
|
mp_uint_t org_size = size;
|
||||||
while (sz > 0) {
|
while (size > 0) {
|
||||||
mp_uint_t out_sz = s->type->stream_p->write(stream, buf, size, errcode);
|
mp_uint_t out_sz = s->type->stream_p->write(stream, buf, size, errcode);
|
||||||
if (out_sz == MP_STREAM_ERROR) {
|
if (out_sz == MP_STREAM_ERROR) {
|
||||||
return MP_STREAM_ERROR;
|
return MP_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
buf += out_sz;
|
buf += out_sz;
|
||||||
sz -= out_sz;
|
size -= out_sz;
|
||||||
}
|
}
|
||||||
return size;
|
return org_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC mp_obj_t stream_write_method(mp_obj_t self_in, mp_obj_t arg) {
|
STATIC mp_obj_t stream_write_method(mp_obj_t self_in, mp_obj_t arg) {
|
||||||
|
|
Loading…
Reference in New Issue