diff options
author | rlar <rlar> | 2016-02-28 16:23:22 +0100 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2016-03-08 15:35:53 -0500 |
commit | 3d640d049d1ba1de2547764f4c2a9c498d193eeb (patch) | |
tree | 61a315d6dc40a1edc1d2082bcd5eb4efb2575e5d /src/buf.c | |
parent | de3fb712c2b0669f761114cea7d8ebfad275310a (diff) |
casts in buf_append() to get rid of warnings
Diffstat (limited to 'src/buf.c')
-rw-r--r-- | src/buf.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -241,26 +241,26 @@ struct Buf *buf_append (struct Buf *buf, const void *ptr, int n_elem) n_alloc = n_elem + buf->nelts; /* ...plus some extra */ - if (((n_alloc * buf->elt_size) % 512) != 0 + if ((((size_t) n_alloc * buf->elt_size) % 512) != 0 && buf->elt_size < 512) - n_alloc += - (512 - - ((n_alloc * buf->elt_size) % 512)) / - buf->elt_size; + n_alloc += (int) + ((512 - + (((size_t) n_alloc * buf->elt_size) % 512)) / + buf->elt_size); if (!buf->elts) buf->elts = - allocate_array (n_alloc, buf->elt_size); + allocate_array ((int) n_alloc, buf->elt_size); else buf->elts = - reallocate_array (buf->elts, n_alloc, + reallocate_array (buf->elts, (int) n_alloc, buf->elt_size); buf->nmax = n_alloc; } - memcpy ((char *) buf->elts + buf->nelts * buf->elt_size, ptr, - n_elem * buf->elt_size); + memcpy (buf->elts + (size_t) buf->nelts * buf->elt_size, ptr, + (size_t) n_elem * buf->elt_size); buf->nelts += n_elem; return buf; |