diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/file.c | 4 | ||||
-rw-r--r-- | unix/modffi.c | 6 | ||||
-rw-r--r-- | unix/modos.c | 14 | ||||
-rw-r--r-- | unix/modsocket.c | 18 |
4 files changed, 21 insertions, 21 deletions
diff --git a/unix/file.c b/unix/file.c index cdec1ad1af..76a44e187c 100644 --- a/unix/file.c +++ b/unix/file.c @@ -114,7 +114,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fdfile___exit___obj, 4, 4, fdfile___e STATIC mp_obj_t fdfile_fileno(mp_obj_t self_in) { mp_obj_fdfile_t *self = self_in; check_fd_is_open(self); - return MP_OBJ_NEW_SMALL_INT((mp_int_t)self->fd); + return MP_OBJ_NEW_SMALL_INT(self->fd); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno); @@ -167,7 +167,7 @@ STATIC mp_obj_t fdfile_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const const char *fname = mp_obj_str_get_str(args[0]); int fd = open(fname, mode, 0644); if (fd == -1) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)errno))); + nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); } o->fd = fd; return o; diff --git a/unix/modffi.c b/unix/modffi.c index 796dec4199..842ed3370e 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -179,7 +179,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) { void *sym = dlsym(self->handle, symname); if (sym == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)errno))); + nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); } int nparams = MP_OBJ_SMALL_INT_VALUE(mp_obj_len_maybe(args[3])); mp_obj_ffifunc_t *o = m_new_obj_var(mp_obj_ffifunc_t, ffi_type*, nparams); @@ -253,7 +253,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna void *sym = dlsym(self->handle, symname); if (sym == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)errno))); + nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); } mp_obj_ffivar_t *o = m_new_obj(mp_obj_ffivar_t); o->base.type = &ffivar_type; @@ -269,7 +269,7 @@ STATIC mp_obj_t ffimod_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const void *mod = dlopen(fname, RTLD_NOW | RTLD_LOCAL); if (mod == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)errno))); + nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); } mp_obj_ffimod_t *o = m_new_obj(mp_obj_ffimod_t); o->base.type = type_in; diff --git a/unix/modos.c b/unix/modos.c index 7ff3fbbb89..5cd78a99fb 100644 --- a/unix/modos.c +++ b/unix/modos.c @@ -40,7 +40,7 @@ #define RAISE_ERRNO(err_flag, error_val) \ { if (err_flag == -1) \ - { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)error_val))); } } + { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error_val))); } } STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { struct stat sb; @@ -51,12 +51,12 @@ STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { RAISE_ERRNO(res, errno); mp_obj_tuple_t *t = mp_obj_new_tuple(10, NULL); - t->items[0] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_mode); - t->items[1] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_ino); - t->items[2] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_dev); - t->items[3] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_nlink); - t->items[4] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_uid); - t->items[5] = MP_OBJ_NEW_SMALL_INT((mp_int_t)sb.st_gid); + t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); + t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.st_ino); + t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.st_dev); + t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.st_nlink); + t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.st_uid); + t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.st_gid); t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.st_size); t->items[7] = MP_OBJ_NEW_SMALL_INT(sb.st_atime); t->items[8] = MP_OBJ_NEW_SMALL_INT(sb.st_mtime); diff --git a/unix/modsocket.c b/unix/modsocket.c index a3380fb89a..d5b8e11c24 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -76,7 +76,7 @@ STATIC const mp_obj_type_t microsocket_type; // Helper functions #define RAISE_ERRNO(err_flag, error_val) \ { if (err_flag == -1) \ - { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)error_val))); } } + { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error_val))); } } STATIC mp_obj_socket_t *socket_new(int fd) { mp_obj_socket_t *o = m_new_obj(mp_obj_socket_t); @@ -120,7 +120,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close); STATIC mp_obj_t socket_fileno(mp_obj_t self_in) { mp_obj_socket_t *self = self_in; - return MP_OBJ_NEW_SMALL_INT((mp_int_t)self->fd); + return MP_OBJ_NEW_SMALL_INT(self->fd); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno); @@ -205,7 +205,7 @@ STATIC mp_obj_t socket_send(uint n_args, const mp_obj_t *args) { int out_sz = send(self->fd, bufinfo.buf, bufinfo.len, flags); RAISE_ERRNO(out_sz, errno); - return MP_OBJ_NEW_SMALL_INT((mp_int_t)out_sz); + return MP_OBJ_NEW_SMALL_INT(out_sz); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send); @@ -255,7 +255,7 @@ STATIC mp_obj_t socket_makefile(uint n_args, const mp_obj_t *args) { mp_obj_socket_t *self = args[0]; mp_obj_t *new_args = alloca(n_args * sizeof(mp_obj_t)); memcpy(new_args + 1, args + 1, (n_args - 1) * sizeof(mp_obj_t)); - new_args[0] = MP_OBJ_NEW_SMALL_INT((mp_int_t)self->fd); + new_args[0] = MP_OBJ_NEW_SMALL_INT(self->fd); return mp_builtin_open(n_args, new_args); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile); @@ -321,7 +321,7 @@ STATIC const mp_obj_type_t microsocket_type = { #if MICROPY_SOCKET_EXTRA STATIC mp_obj_t mod_socket_htons(mp_obj_t arg) { - return MP_OBJ_NEW_SMALL_INT((mp_int_t)htons(MP_OBJ_SMALL_INT_VALUE(arg))); + return MP_OBJ_NEW_SMALL_INT(htons(MP_OBJ_SMALL_INT_VALUE(arg))); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_htons_obj, mod_socket_htons); @@ -343,7 +343,7 @@ STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) { struct hostent *h = gethostbyname(s); if (h == NULL) { // CPython: socket.herror - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)h_errno))); + nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(h_errno))); } assert(h->h_length == 4); return mp_obj_new_int(*(int*)*h->h_addr_list); @@ -397,9 +397,9 @@ STATIC mp_obj_t mod_socket_getaddrinfo(uint n_args, const mp_obj_t *args) { mp_obj_t list = mp_obj_new_list(0, NULL); for (struct addrinfo *addr = addr_list; addr; addr = addr->ai_next) { mp_obj_tuple_t *t = mp_obj_new_tuple(5, NULL); - t->items[0] = MP_OBJ_NEW_SMALL_INT((mp_int_t)addr->ai_family); - t->items[1] = MP_OBJ_NEW_SMALL_INT((mp_int_t)addr->ai_socktype); - t->items[2] = MP_OBJ_NEW_SMALL_INT((mp_int_t)addr->ai_protocol); + t->items[0] = MP_OBJ_NEW_SMALL_INT(addr->ai_family); + t->items[1] = MP_OBJ_NEW_SMALL_INT(addr->ai_socktype); + t->items[2] = MP_OBJ_NEW_SMALL_INT(addr->ai_protocol); // "canonname will be a string representing the canonical name of the host // if AI_CANONNAME is part of the flags argument; else canonname will be empty." ?? if (addr->ai_canonname) { |