From 883a2e629844bf695381950191fbbc25988b611f Mon Sep 17 00:00:00 2001 From: Christophe Tournery Date: Wed, 21 Aug 2013 23:26:40 +0200 Subject: [PATCH] Better solution to fix 64 bit compiler warnings Use the size_t data type where appropriate instead of casting. --- src/dictionary.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dictionary.c b/src/dictionary.c index 6c8e493..b62808a 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -35,7 +35,7 @@ /* Doubles the allocated size associated to a pointer */ /* 'size' is the current allocated size. */ -static void * mem_double(void * ptr, int size) +static void * mem_double(void * ptr, size_t size) { void * newptr ; @@ -87,11 +87,11 @@ static char * xstrdup(const char * s) /*--------------------------------------------------------------------------*/ unsigned dictionary_hash(const char * key) { - int len ; + size_t len ; unsigned hash ; - int i ; + size_t i ; - len = (int)strlen(key); + len = strlen(key); for (hash=0, i=0 ; in==d->size) { /* Reached maximum size: reallocate dictionary */ - d->val = (char **)mem_double(d->val, d->size * (int)sizeof(char*)) ; - d->key = (char **)mem_double(d->key, d->size * (int)sizeof(char*)) ; - d->hash = (unsigned int *)mem_double(d->hash, d->size * (int)sizeof(unsigned)) ; + d->val = (char **)mem_double(d->val, d->size * sizeof(char*)) ; + d->key = (char **)mem_double(d->key, d->size * sizeof(char*)) ; + d->hash = (unsigned int *)mem_double(d->hash, d->size * sizeof(unsigned)) ; if ((d->val==NULL) || (d->key==NULL) || (d->hash==NULL)) { /* Cannot grow dictionary */ return -1 ; -- GitLab