diff options
| author | Damien George | 2015-01-16 17:47:07 +0000 |
|---|---|---|
| committer | Damien George | 2015-01-16 17:47:07 +0000 |
| commit | 963a5a3e82ded7ee75adae72ae7cb14796fa150e (patch) | |
| tree | 78402c85b98c1c8f1889d7af7dc6f4828a8f55a5 /unix | |
| parent | f12ea7c7ed1ef97ee48c4356dbbc808cc2bdee4a (diff) | |
py, unix: Allow to compile with -Wsign-compare.
See issue #699.
Diffstat (limited to 'unix')
| -rw-r--r-- | unix/main.c | 4 | ||||
| -rw-r--r-- | unix/modffi.c | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/unix/main.c b/unix/main.c index d63512778..346324e7c 100644 --- a/unix/main.c +++ b/unix/main.c @@ -355,7 +355,7 @@ int main(int argc, char **argv) { mp_obj_list_get(mp_sys_path, &path_num, &path_items); path_items[0] = MP_OBJ_NEW_QSTR(MP_QSTR_); char *p = path; - for (int i = 1; i < path_num; i++) { + for (mp_uint_t i = 1; i < path_num; i++) { char *p1 = strchr(p, PATHLIST_SEP_CHAR); if (p1 == NULL) { p1 = p + strlen(p); @@ -364,7 +364,7 @@ int main(int argc, char **argv) { // Expand standalone ~ to $HOME CHECKBUF(buf, PATH_MAX); CHECKBUF_APPEND(buf, home, strlen(home)); - CHECKBUF_APPEND(buf, p + 1, p1 - p - 1); + CHECKBUF_APPEND(buf, p + 1, (size_t)(p1 - p - 1)); path_items[i] = MP_OBJ_NEW_QSTR(qstr_from_strn(buf, CHECKBUF_LEN(buf))); } else { path_items[i] = MP_OBJ_NEW_QSTR(qstr_from_strn(p, p1 - p)); diff --git a/unix/modffi.c b/unix/modffi.c index fb0c820d2..5f33e7721 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -206,7 +206,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ffimod_func_obj, 4, 4, ffimod_func); STATIC void call_py_func(ffi_cif *cif, void *ret, void** args, mp_obj_t func) { mp_obj_t pyargs[cif->nargs]; - for (int i = 0; i < cif->nargs; i++) { + for (uint i = 0; i < cif->nargs; i++) { pyargs[i] = mp_obj_new_int(*(mp_int_t*)args[i]); } mp_obj_t res = mp_call_function_n_kw(func, cif->nargs, 0, pyargs); @@ -309,8 +309,7 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, ffi_arg values[n_args]; void *valueptrs[n_args]; - int i; - for (i = 0; i < n_args; i++) { + for (uint i = 0; i < n_args; i++) { mp_obj_t a = args[i]; if (a == mp_const_none) { values[i] = 0; |
