1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r15325: Fix compiler warnings

(This used to be commit 5d51047fe3)
This commit is contained in:
Jelmer Vernooij 2006-04-29 16:12:01 +00:00 committed by Gerald (Jerry) Carter
parent fc487fb552
commit 6e62c6beac

View File

@ -119,9 +119,9 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout)
if (!valstr) if (!valstr)
return False; return False;
keybuf.dptr = strdup(keystr); keybuf.dptr = (uint8_t *)strdup(keystr);
keybuf.dsize = strlen(keystr)+1; keybuf.dsize = strlen(keystr)+1;
databuf.dptr = strdup(valstr); databuf.dptr = (uint8_t *)strdup(valstr);
databuf.dsize = strlen(valstr)+1; databuf.dsize = strlen(valstr)+1;
DEBUG(10, ("Adding cache entry with key = %s; value = %s and timeout \ DEBUG(10, ("Adding cache entry with key = %s; value = %s and timeout \
= %s (%d seconds %s)\n", keybuf.dptr, value, ctime(&timeout), = %s (%d seconds %s)\n", keybuf.dptr, value, ctime(&timeout),
@ -171,9 +171,9 @@ BOOL gencache_set_only(const char *keystr, const char *valstr, time_t timeout)
= %s\n", keystr, old_valstr, ctime(&old_timeout))); = %s\n", keystr, old_valstr, ctime(&old_timeout)));
asprintf(&datastr, CACHE_DATA_FMT, (int)timeout, valstr); asprintf(&datastr, CACHE_DATA_FMT, (int)timeout, valstr);
keybuf.dptr = strdup(keystr); keybuf.dptr = (uint8_t *)strdup(keystr);
keybuf.dsize = strlen(keystr)+1; keybuf.dsize = strlen(keystr)+1;
databuf.dptr = strdup(datastr); databuf.dptr = (uint8_t *)strdup(datastr);
databuf.dsize = strlen(datastr)+1; databuf.dsize = strlen(datastr)+1;
DEBUGADD(10, ("New value = %s, new timeout = %s (%d seconds %s)", valstr, DEBUGADD(10, ("New value = %s, new timeout = %s (%d seconds %s)", valstr,
ctime(&timeout), (int)(timeout - time(NULL)), ctime(&timeout), (int)(timeout - time(NULL)),
@ -210,7 +210,7 @@ BOOL gencache_del(const char *keystr)
if (!gencache_init()) return False; if (!gencache_init()) return False;
keybuf.dptr = strdup(keystr); keybuf.dptr = (uint8_t *)strdup(keystr);
keybuf.dsize = strlen(keystr)+1; keybuf.dsize = strlen(keystr)+1;
DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr)); DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr));
ret = tdb_delete(cache->tdb, keybuf); ret = tdb_delete(cache->tdb, keybuf);
@ -243,13 +243,13 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
if (!gencache_init()) if (!gencache_init())
return False; return False;
keybuf.dptr = strdup(keystr); keybuf.dptr = (uint8_t *)strdup(keystr);
keybuf.dsize = strlen(keystr)+1; keybuf.dsize = strlen(keystr)+1;
databuf = tdb_fetch(cache->tdb, keybuf); databuf = tdb_fetch(cache->tdb, keybuf);
SAFE_FREE(keybuf.dptr); SAFE_FREE(keybuf.dptr);
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) { if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
char* entry_buf = strndup(databuf.dptr, databuf.dsize); char* entry_buf = strndup((char *)databuf.dptr, databuf.dsize);
char *v; char *v;
time_t t; time_t t;
unsigned i; unsigned i;
@ -323,7 +323,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
while (node) { while (node) {
/* ensure null termination of the key string */ /* ensure null termination of the key string */
keystr = strndup(node->node_key.dptr, node->node_key.dsize); keystr = strndup((char *)node->node_key.dptr, node->node_key.dsize);
/* /*
* We don't use gencache_get function, because we need to iterate through * We don't use gencache_get function, because we need to iterate through
@ -336,7 +336,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
node = node->next; node = node->next;
continue; continue;
} }
entry = strndup(databuf.dptr, databuf.dsize); entry = strndup((char *)databuf.dptr, databuf.dsize);
SAFE_FREE(databuf.dptr); SAFE_FREE(databuf.dptr);
valstr = malloc_array_p(char, databuf.dsize - TIMEOUT_LEN); valstr = malloc_array_p(char, databuf.dsize - TIMEOUT_LEN);
sscanf(entry, CACHE_DATA_FMT, (int*)(&i), valstr); sscanf(entry, CACHE_DATA_FMT, (int*)(&i), valstr);