From 738bdeb73a6ef802ed0c39fb88a733a1ad04d9a1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Apr 2014 22:31:24 +0100 Subject: [PATCH] unix: Update to use new buffer protocol interface with typecode. --- unix/modffi.c | 6 +++--- unix/modsocket.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unix/modffi.c b/unix/modffi.c index fd48aa17ec..7b8e43874b 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -268,9 +268,9 @@ mp_obj_t ffifunc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t * values[i] = (ffi_arg)s; } else if (((mp_obj_base_t*)a)->type->buffer_p.get_buffer != NULL) { mp_obj_base_t *o = (mp_obj_base_t*)a; - buffer_info_t bufinfo; - o->type->buffer_p.get_buffer(o, &bufinfo, BUFFER_READ); // TODO: BUFFER_READ? - if (bufinfo.buf == NULL) { + mp_buffer_info_t bufinfo; + int ret = o->type->buffer_p.get_buffer(o, &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ? + if (ret != 0 || bufinfo.buf == NULL) { goto error; } values[i] = (ffi_arg)bufinfo.buf; diff --git a/unix/modsocket.c b/unix/modsocket.c index 7b1aaa975d..44ad698e4a 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -80,7 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno); STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { mp_obj_socket_t *self = self_in; - buffer_info_t bufinfo; + mp_buffer_info_t bufinfo; mp_get_buffer_raise(addr_in, &bufinfo); int r = connect(self->fd, (const struct sockaddr *)bufinfo.buf, bufinfo.len); RAISE_ERRNO(r, errno); @@ -90,7 +90,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect); STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) { mp_obj_socket_t *self = self_in; - buffer_info_t bufinfo; + mp_buffer_info_t bufinfo; mp_get_buffer_raise(addr_in, &bufinfo); int r = bind(self->fd, (const struct sockaddr *)bufinfo.buf, bufinfo.len); RAISE_ERRNO(r, errno); @@ -168,7 +168,7 @@ STATIC mp_obj_t socket_setsockopt(uint n_args, const mp_obj_t *args) { optval = &val; optlen = sizeof(val); } else { - buffer_info_t bufinfo; + mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[3], &bufinfo); optval = bufinfo.buf; optlen = bufinfo.len;