Silence miscellaneous 64-to-32-bit data loss warnings.

This commit is contained in:
Jason Evans
2016-02-24 12:42:23 -08:00
parent 1c42a04cc6
commit 9e1810ca9d
13 changed files with 49 additions and 41 deletions

View File

@@ -138,22 +138,22 @@ TEST_END
TEST_BEGIN(test_lg_align_and_zero)
{
void *p, *q;
size_t lg_align, sz;
unsigned lg_align;
size_t sz;
#define MAX_LG_ALIGN 25
#define MAX_VALIDATE (ZU(1) << 22)
lg_align = ZU(0);
lg_align = 0;
p = mallocx(1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
assert_ptr_not_null(p, "Unexpected mallocx() error");
for (lg_align++; lg_align <= MAX_LG_ALIGN; lg_align++) {
q = rallocx(p, 1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
assert_ptr_not_null(q,
"Unexpected rallocx() error for lg_align=%zu", lg_align);
"Unexpected rallocx() error for lg_align=%u", lg_align);
assert_ptr_null(
(void *)((uintptr_t)q & ((ZU(1) << lg_align)-1)),
"%p inadequately aligned for lg_align=%zu",
q, lg_align);
"%p inadequately aligned for lg_align=%u", q, lg_align);
sz = sallocx(q, 0);
if ((sz << 1) <= MAX_VALIDATE) {
assert_false(validate_fill(q, 0, 0, sz),

View File

@@ -35,7 +35,7 @@ typedef enum {
hash_variant_x64_128
} hash_variant_t;
static size_t
static int
hash_variant_bits(hash_variant_t variant)
{
@@ -63,7 +63,7 @@ hash_variant_string(hash_variant_t variant)
static void
hash_variant_verify_key(hash_variant_t variant, uint8_t *key)
{
const size_t hashbytes = hash_variant_bits(variant) / 8;
const int hashbytes = hash_variant_bits(variant) / 8;
VARIABLE_ARRAY(uint8_t, hashes, hashbytes * 256);
VARIABLE_ARRAY(uint8_t, final, hashbytes);
unsigned i;