summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--lib/utils/printf.c2
-rw-r--r--py/emitglue.c4
-rw-r--r--py/mpprint.c6
-rw-r--r--py/mpprint.h4
-rw-r--r--py/stream.c2
-rw-r--r--py/stream.h2
6 files changed, 10 insertions, 10 deletions
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index b868d974c2..34bf3eb0fc 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -92,7 +92,7 @@ typedef struct _strn_print_env_t {
size_t remain;
} strn_print_env_t;
-STATIC void strn_print_strn(void *data, const char *str, mp_uint_t len) {
+STATIC void strn_print_strn(void *data, const char *str, size_t len) {
strn_print_env_t *strn_print_env = data;
if (len > strn_print_env->remain) {
len = strn_print_env->remain;
diff --git a/py/emitglue.c b/py/emitglue.c
index 344a3d96d7..4eb9b76aa4 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -606,8 +606,8 @@ void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) {
#include <sys/stat.h>
#include <fcntl.h>
-STATIC void fd_print_strn(void *env, const char *str, mp_uint_t len) {
- int fd = (mp_int_t)env;
+STATIC void fd_print_strn(void *env, const char *str, size_t len) {
+ int fd = (intptr_t)env;
ssize_t ret = write(fd, str, len);
(void)ret;
}
diff --git a/py/mpprint.c b/py/mpprint.c
index 0aecf5c56d..6b1f8b9134 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -43,7 +43,7 @@
static const char pad_spaces[] = " ";
static const char pad_zeroes[] = "0000000000000000";
-STATIC void plat_print_strn(void *env, const char *str, mp_uint_t len) {
+STATIC void plat_print_strn(void *env, const char *str, size_t len) {
(void)env;
MP_PLAT_PRINT_STRN(str, len);
}
@@ -51,14 +51,14 @@ STATIC void plat_print_strn(void *env, const char *str, mp_uint_t len) {
const mp_print_t mp_plat_print = {NULL, plat_print_strn};
int mp_print_str(const mp_print_t *print, const char *str) {
- mp_uint_t len = strlen(str);
+ size_t len = strlen(str);
if (len) {
print->print_strn(print->data, str, len);
}
return len;
}
-int mp_print_strn(const mp_print_t *print, const char *str, mp_uint_t len, int flags, char fill, int width) {
+int mp_print_strn(const mp_print_t *print, const char *str, size_t len, int flags, char fill, int width) {
int left_pad = 0;
int right_pad = 0;
int pad = width - len;
diff --git a/py/mpprint.h b/py/mpprint.h
index 1770fcffe3..6e47409ecc 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -39,7 +39,7 @@
#define PF_FLAG_ADD_PERCENT (0x100)
#define PF_FLAG_SHOW_OCTAL_LETTER (0x200)
-typedef void (*mp_print_strn_t)(void *data, const char *str, mp_uint_t len);
+typedef void (*mp_print_strn_t)(void *data, const char *str, size_t len);
typedef struct _mp_print_t {
void *data;
@@ -55,7 +55,7 @@ extern const mp_print_t mp_sys_stdout_print;
#endif
int mp_print_str(const mp_print_t *print, const char *str);
-int mp_print_strn(const mp_print_t *print, const char *str, mp_uint_t len, int flags, char fill, int width);
+int mp_print_strn(const mp_print_t *print, const char *str, size_t len, int flags, char fill, int width);
#if MICROPY_PY_BUILTINS_FLOAT
int mp_print_float(const mp_print_t *print, mp_float_t f, char fmt, int flags, char fill, int width, int prec);
#endif
diff --git a/py/stream.c b/py/stream.c
index 6be2c4f3eb..5c161ec2dc 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -174,7 +174,7 @@ STATIC mp_obj_t stream_read(mp_uint_t n_args, const mp_obj_t *args) {
}
}
-mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t len) {
+mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, size_t len) {
struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)self_in;
if (o->type->stream_p == NULL || o->type->stream_p->write == NULL) {
// CPython: io.UnsupportedOperation, OSError subclass
diff --git a/py/stream.h b/py/stream.h
index 5eace916fe..16761217aa 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -40,7 +40,7 @@ MP_DECLARE_CONST_FUN_OBJ(mp_stream_tell_obj);
// Iterator which uses mp_stream_unbuffered_readline_obj
mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self);
-mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t len);
+mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, size_t len);
#if MICROPY_STREAMS_NON_BLOCK
// TODO: This is POSIX-specific (but then POSIX is the only real thing,