In this code, committed in
c7374588519a7ac557c14b38c147623dedf43fdb in 2014, it
is not clear to me why int was used. The correct type for these kind of
operations is size_t. The size_t type has been available since at least 1995, if
not earlier depending on your toolchain. Squashes 3
-Wsign-conversion/-Wconversion warnings.
typedef struct {
char* data;
- int sz; /* buffer size */
- int len; /* length of array */
+ size_t sz; /* buffer size */
+ size_t len; /* length of array */
} BA;
static size_t gv_string_writer(GVJ_t *job, const char *s, size_t len)
{
BA* bap = (BA*)(job->output_file);
-/* fprintf (stderr, "newlen %ld data %p sz %d len %d\n", len, bap->data,bap->sz, bap->len); */
- int newlen = bap->len + len;
+ size_t newlen = bap->len + len;
if (newlen > bap->sz) {
bap->sz *= 2;
if (newlen > bap->sz)