summaryrefslogtreecommitdiffstats
path: root/buf.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-06 06:46:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-06 06:46:28 -0700
commit7f35218581067e5b3449258326a54235d6e10bbc (patch)
treef94237cef9897672654d603ef43fbe45844b7a6f /buf.c
parent840330f271f25b093c7a86b41e7cddaec0cb6d7f (diff)
downloadtxr-7f35218581067e5b3449258326a54235d6e10bbc.tar.gz
txr-7f35218581067e5b3449258326a54235d6e10bbc.tar.bz2
txr-7f35218581067e5b3449258326a54235d6e10bbc.zip
c++ maintenance: eliminate old-style casts.
Old style casts have crept into the code base. * buf.c (make_buf, buf_grow, buf_get_i8, buf_get_u8): Replace old style cast with macro. * ffi.c (align_sw_get, align_sw_put, ffi_be_i32_get, ffi_be_u32_get, ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_get, ffi_be_i64_put, ffi_be_i64_get, ffi_be_u64_get, ffi_le_i64_put, ffi_le_i64_get, ffi_le_u64_get, ffi_sbit_put, ffi_sbit_get, ffi_init_extra_types): Likewise. * hash.c (hash_buf): Likewise. * itypes.c (c_i32, c_i64, c_u64): Likewise. * stream.c (stdio_put_buf, stdio_fill_buf): Likewise.
Diffstat (limited to 'buf.c')
-rw-r--r--buf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/buf.c b/buf.c
index 2ce10309..269ccded 100644
--- a/buf.c
+++ b/buf.c
@@ -91,7 +91,7 @@ val make_buf(val len, val init_val, val alloc_size)
obj->b.size = num(size);
if (iv != 0)
- memset(data, (unsigned char) iv, c_num(len));
+ memset(data, convert(unsigned char, iv), c_num(len));
return obj;
}
@@ -145,7 +145,7 @@ static void buf_grow(struct buf *b, val init_val, val self)
if (size > oldsize) {
b->data = chk_realloc(b->data, size);
b->size = num(size);
- memset(b->data + oldsize, (unsigned char) iv, size - oldsize);
+ memset(b->data + oldsize, convert(unsigned char, iv), size - oldsize);
}
}
@@ -426,7 +426,7 @@ val buf_get_i8(val buf, val pos)
cnum p = buf_check_index(pos, self);
if (p >= c_num(b->len))
uw_throwf(error_s, lit("~a: attempted read past buffer end"), self, nao);
- return num_fast((i8_t) b->data[p]);
+ return num_fast(convert(i8_t, b->data[p]));
}
val buf_get_u8(val buf, val pos)
@@ -436,7 +436,7 @@ val buf_get_u8(val buf, val pos)
cnum p = buf_check_index(pos, self);
if (p >= c_num(b->len))
uw_throwf(error_s, lit("~a: attempted read past buffer end"), self, nao);
- return num_fast((u8_t) b->data[p]);
+ return num_fast(convert(u8_t, b->data[p]));
}
#endif