Commit 963a5a3e authored by Damien George's avatar Damien George
Browse files

py, unix: Allow to compile with -Wsign-compare.

See issue #699.
parent f12ea7c7
......@@ -350,7 +350,7 @@ void vstr_vprintf(vstr_t *vstr, const char *fmt, va_list ap) {
va_end(ap2);
// if that worked, return
if (n > -1 && n < size) {
if (n > -1 && (size_t)n < size) {
vstr->len += n;
return;
}
......
......@@ -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));
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment