diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-03-29 09:35:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:00 -0500 |
commit | bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 (patch) | |
tree | 45124e070043ee0fd3774d74b4cfdcf1c8919c27 /source3/tdb | |
parent | b9461058d59f8e4f4b69c31592bd12a179b2d8ac (diff) | |
download | samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.gz samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.bz2 samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.zip |
r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users
metze
(This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
Diffstat (limited to 'source3/tdb')
-rw-r--r-- | source3/tdb/common/freelistcheck.c | 2 | ||||
-rw-r--r-- | source3/tdb/common/io.c | 8 | ||||
-rw-r--r-- | source3/tdb/common/tdb.c | 6 | ||||
-rw-r--r-- | source3/tdb/common/tdb_private.h | 2 | ||||
-rw-r--r-- | source3/tdb/common/traverse.c | 2 | ||||
-rw-r--r-- | source3/tdb/include/tdb.h | 2 | ||||
-rw-r--r-- | source3/tdb/tools/tdbdump.c | 2 | ||||
-rw-r--r-- | source3/tdb/tools/tdbtool.c | 22 |
8 files changed, 23 insertions, 23 deletions
diff --git a/source3/tdb/common/freelistcheck.c b/source3/tdb/common/freelistcheck.c index 3f79a016b8..63d2dbadc2 100644 --- a/source3/tdb/common/freelistcheck.c +++ b/source3/tdb/common/freelistcheck.c @@ -39,7 +39,7 @@ static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr) TDB_DATA key, data; memset(&data, '\0', sizeof(data)); - key.dptr = (char *)&rec_ptr; + key.dptr = (unsigned char *)&rec_ptr; key.dsize = sizeof(rec_ptr); return tdb_store(mem_tdb, key, data, TDB_INSERT); } diff --git a/source3/tdb/common/io.c b/source3/tdb/common/io.c index 9a8e270dcc..cd06dbb1e3 100644 --- a/source3/tdb/common/io.c +++ b/source3/tdb/common/io.c @@ -332,16 +332,16 @@ int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d) /* read a lump of data, allocating the space for it */ -char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len) +unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len) { - char *buf; + unsigned char *buf; /* some systems don't like zero length malloc */ if (len == 0) { len = 1; } - if (!(buf = (char *)malloc(len))) { + if (!(buf = (unsigned char *)malloc(len))) { /* Ensure ecode is set for log fn. */ tdb->ecode = TDB_ERR_OOM; TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_alloc_read malloc failed len=%d (%s)\n", @@ -376,7 +376,7 @@ int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key, if (tdb->methods->tdb_oob(tdb, offset+len, 0) != 0) { return -1; } - data.dptr = offset + (char *)tdb->map_ptr; + data.dptr = offset + (unsigned char *)tdb->map_ptr; return parser(key, data, private_data); } diff --git a/source3/tdb/common/tdb.c b/source3/tdb/common/tdb.c index bf43701d2e..25103d826e 100644 --- a/source3/tdb/common/tdb.c +++ b/source3/tdb/common/tdb.c @@ -564,10 +564,10 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf) dbuf = tdb_fetch(tdb, key); if (dbuf.dptr == NULL) { - dbuf.dptr = (char *)malloc(new_dbuf.dsize); + dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize); } else { - dbuf.dptr = (char *)realloc(dbuf.dptr, - dbuf.dsize + new_dbuf.dsize); + dbuf.dptr = (unsigned char *)realloc(dbuf.dptr, + dbuf.dsize + new_dbuf.dsize); } if (dbuf.dptr == NULL) { diff --git a/source3/tdb/common/tdb_private.h b/source3/tdb/common/tdb_private.h index 10bc6dacdc..9d39de0200 100644 --- a/source3/tdb/common/tdb_private.h +++ b/source3/tdb/common/tdb_private.h @@ -196,7 +196,7 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off); int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec); int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec); int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec); -char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len); +unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len); int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key, tdb_off_t offset, tdb_len_t len, int (*parser)(TDB_DATA key, TDB_DATA data, diff --git a/source3/tdb/common/traverse.c b/source3/tdb/common/traverse.c index 6d3b111479..fb2371d403 100644 --- a/source3/tdb/common/traverse.c +++ b/source3/tdb/common/traverse.c @@ -279,7 +279,7 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) u32 oldhash; TDB_DATA key = tdb_null; struct list_struct rec; - char *k = NULL; + unsigned char *k = NULL; /* Is locked key the old key? If so, traverse will be reliable. */ if (tdb->travlocks.off) { diff --git a/source3/tdb/include/tdb.h b/source3/tdb/include/tdb.h index 51bf709f44..dafe2a130e 100644 --- a/source3/tdb/include/tdb.h +++ b/source3/tdb/include/tdb.h @@ -60,7 +60,7 @@ enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR, TDB_DEBUG_WARNING, TDB_DEBUG_TRACE}; typedef struct TDB_DATA { - char *dptr; + unsigned char *dptr; size_t dsize; } TDB_DATA; diff --git a/source3/tdb/tools/tdbdump.c b/source3/tdb/tools/tdbdump.c index b702fb0735..2ff2a2b019 100644 --- a/source3/tdb/tools/tdbdump.c +++ b/source3/tdb/tools/tdbdump.c @@ -73,7 +73,7 @@ static int dump_tdb(const char *fname, const char *keyname) if (!keyname) { tdb_traverse(tdb, traverse_fn, NULL); } else { - key.dptr = (char *)keyname; + key.dptr = (unsigned char *)keyname; key.dsize = strlen( keyname); value = tdb_fetch(tdb, key); if (!value.dptr) { diff --git a/source3/tdb/tools/tdbtool.c b/source3/tdb/tools/tdbtool.c index bcfb96adc0..137675a88f 100644 --- a/source3/tdb/tools/tdbtool.c +++ b/source3/tdb/tools/tdbtool.c @@ -237,9 +237,9 @@ static void insert_tdb(char *keyname, size_t keylen, char* data, size_t datalen) return; } - key.dptr = keyname; + key.dptr = (unsigned char *)keyname; key.dsize = keylen; - dbuf.dptr = data; + dbuf.dptr = (unsigned char *)data; dbuf.dsize = datalen; if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) { @@ -261,9 +261,9 @@ static void store_tdb(char *keyname, size_t keylen, char* data, size_t datalen) return; } - key.dptr = keyname; + key.dptr = (unsigned char *)keyname; key.dsize = keylen; - dbuf.dptr = data; + dbuf.dptr = (unsigned char *)data; dbuf.dsize = datalen; printf("Storing key:\n"); @@ -283,7 +283,7 @@ static void show_tdb(char *keyname, size_t keylen) return; } - key.dptr = keyname; + key.dptr = (unsigned char *)keyname; key.dsize = keylen; dbuf = tdb_fetch(tdb, key); @@ -308,7 +308,7 @@ static void delete_tdb(char *keyname, size_t keylen) return; } - key.dptr = keyname; + key.dptr = (unsigned char *)keyname; key.dsize = keylen; if (tdb_delete(tdb, key) != 0) { @@ -331,7 +331,7 @@ static void move_rec(char *keyname, size_t keylen, char* tdbname) return; } - key.dptr = keyname; + key.dptr = (unsigned char *)keyname; key.dsize = keylen; dbuf = tdb_fetch(tdb, key); @@ -404,16 +404,16 @@ static int print_crec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *s static int print_arec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { printf("\nkey %d bytes\n", (int)key.dsize); - print_asc(key.dptr, key.dsize); + print_asc((const char *)key.dptr, key.dsize); printf("\ndata %d bytes\n", (int)dbuf.dsize); - print_data(dbuf.dptr, dbuf.dsize); + print_data((const char *)dbuf.dptr, dbuf.dsize); return 0; } static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { printf("key %d bytes: ", (int)key.dsize); - print_asc(key.dptr, key.dsize); + print_asc((const char *)key.dptr, key.dsize); printf("\n"); return 0; } @@ -421,7 +421,7 @@ static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *st static int print_hexkey(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { printf("key %d bytes\n", (int)key.dsize); - print_data(key.dptr, key.dsize); + print_data((const char *)key.dptr, key.dsize); printf("\n"); return 0; } |