diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-12 21:50:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-12 21:50:49 -0700 |
commit | f073dc1201ae0b4c9cebc430b7bde52d1cc2b170 (patch) | |
tree | 2e2a00b5b5d2e0e7f673a12516d2d10c75d73ab8 | |
parent | 8bdbe5bfa71c52d6ee40410f6f4f1d75e4e2ccb0 (diff) | |
download | txr-f073dc1201ae0b4c9cebc430b7bde52d1cc2b170.tar.gz txr-f073dc1201ae0b4c9cebc430b7bde52d1cc2b170.tar.bz2 txr-f073dc1201ae0b4c9cebc430b7bde52d1cc2b170.zip |
Follow up on C++ diagnostics.
* ffi.c (ffi_generic_sbit_put, fi_generic_sbit_get,
ffi_generic_ubit_put, fi_generic_ubit_get): Add needed
coerce from zalloca to mem_t *.
(make_ffi_type_struct): Fix signed/unsigned comparison.
* lib.c (vector): Fix signed/unsigned comparison.
-rw-r--r-- | ffi.c | 12 | ||||
-rw-r--r-- | lib.c | 2 |
2 files changed, 7 insertions, 7 deletions
@@ -1409,7 +1409,7 @@ static val ffi_ubit_get(struct txr_ffi_type *tft, mem_t *src, val self) static void ffi_generic_sbit_put(struct txr_ffi_type *tft, val n, mem_t *dst, val self) { - mem_t *tmp = zalloca(sizeof (int)); + mem_t *tmp = coerce(mem_t *, zalloca(sizeof (int))); memcpy(tmp, dst, tft->size); ffi_sbit_put(tft, n, tmp, self); memcpy(dst, tmp, tft->size); @@ -1418,7 +1418,7 @@ static void ffi_generic_sbit_put(struct txr_ffi_type *tft, val n, static val ffi_generic_sbit_get(struct txr_ffi_type *tft, mem_t *src, val self) { - mem_t *tmp = zalloca(sizeof (int)); + mem_t *tmp = coerce(mem_t *, zalloca(sizeof (int))); memcpy(tmp, src, tft->size); return ffi_sbit_get(tft, tmp, self); } @@ -1426,7 +1426,7 @@ static val ffi_generic_sbit_get(struct txr_ffi_type *tft, static void ffi_generic_ubit_put(struct txr_ffi_type *tft, val n, mem_t *dst, val self) { - mem_t *tmp = zalloca(sizeof (int)); + mem_t *tmp = coerce(mem_t *, zalloca(sizeof (int))); memcpy(tmp, dst, tft->size); ffi_ubit_put(tft, n, tmp, self); memcpy(dst, tmp, tft->size); @@ -1435,7 +1435,7 @@ static void ffi_generic_ubit_put(struct txr_ffi_type *tft, val n, static val ffi_generic_ubit_get(struct txr_ffi_type *tft, mem_t *src, val self) { - mem_t *tmp = zalloca(sizeof (int)); + mem_t *tmp = coerce(mem_t *, zalloca(sizeof (int))); memcpy(tmp, src, tft->size); return ffi_ubit_get(tft, tmp, self); } @@ -2744,7 +2744,7 @@ static val make_ffi_type_struct(val syntax, val lisp_type, ucnum most_align = 0; int need_out_handler = 0; int bit_offs = 0; - const int bits_int = 8 * sizeof(int); + const unsigned bits_int = 8 * sizeof(int); ft->type = FFI_TYPE_STRUCT; ft->size = 0; @@ -2800,7 +2800,7 @@ static val make_ffi_type_struct(val syntax, val lisp_type, } if (bits_alloc == 0) { - if (most_align < mtft->align) + if (most_align < (ucnum) mtft->align) most_align = mtft->align; } @@ -6718,7 +6718,7 @@ val dupl(val fun) val vector(val length, val initval) { - int i; + unsigned i; ucnum len = c_unum(length); ucnum alloc_plus = len + 2; ucnum size = if3(alloc_plus > len, alloc_plus, -1); |