summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-03-29 09:35:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:00 -0500
commitbc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 (patch)
tree45124e070043ee0fd3774d74b4cfdcf1c8919c27 /source3/lib
parentb9461058d59f8e4f4b69c31592bd12a179b2d8ac (diff)
downloadsamba-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/lib')
-rw-r--r--source3/lib/gencache.c6
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_pack.c2
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_tdb.c2
-rw-r--r--source3/lib/messages.c12
-rw-r--r--source3/lib/privileges.c6
-rw-r--r--source3/lib/util_tdb.c30
6 files changed, 29 insertions, 29 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index d6f5584c12..af60ee1ff4 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -205,7 +205,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
return False;
}
- t = strtol(databuf.dptr, &endptr, 10);
+ t = strtol((const char *)databuf.dptr, &endptr, 10);
if ((endptr == NULL) || (*endptr != '/')) {
DEBUG(2, ("Invalid gencache data format: %s\n", databuf.dptr));
@@ -279,7 +279,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
char *fmt;
/* ensure null termination of the key string */
- keystr = SMB_STRNDUP(node->node_key.dptr, node->node_key.dsize);
+ keystr = SMB_STRNDUP((const char *)node->node_key.dptr, node->node_key.dsize);
if (!keystr) {
break;
}
@@ -295,7 +295,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
node = node->next;
continue;
}
- entry = SMB_STRNDUP(databuf.dptr, databuf.dsize);
+ entry = SMB_STRNDUP((const char *)databuf.dptr, databuf.dsize);
if (!entry) {
SAFE_FREE(databuf.dptr);
SAFE_FREE(keystr);
diff --git a/source3/lib/ldb/ldb_tdb/ldb_pack.c b/source3/lib/ldb/ldb_tdb/ldb_pack.c
index 50dc20524f..45fcf354a5 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_pack.c
@@ -114,7 +114,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
/* allocate it */
- data->dptr = talloc_array(ldb, char, size);
+ data->dptr = talloc_array(ldb, uint8_t, size);
if (!data->dptr) {
talloc_free(dn);
errno = ENOMEM;
diff --git a/source3/lib/ldb/ldb_tdb/ldb_tdb.c b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
index 34daba69bf..fead100f72 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -151,7 +151,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn)
goto failed;
}
- key.dptr = (char *)key_str;
+ key.dptr = (uint8_t *)key_str;
key.dsize = strlen(key_str) + 1;
return key;
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index e2c8a6b52f..336a9349e6 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -159,7 +159,7 @@ static TDB_DATA message_key_pid(struct process_id pid)
slprintf(key, sizeof(key)-1, "PID/%s", procid_str_static(&pid));
- kbuf.dptr = (char *)key;
+ kbuf.dptr = (uint8 *)key;
kbuf.dsize = strlen(key)+1;
return kbuf;
}
@@ -233,7 +233,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
TDB_DATA dbuf;
TDB_DATA old_dbuf;
struct message_rec rec;
- char *ptr;
+ uint8 *ptr;
struct message_rec prec;
/* NULL pointer means implicit length zero. */
@@ -256,7 +256,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
kbuf = message_key_pid(pid);
- dbuf.dptr = (char *)SMB_MALLOC(len + sizeof(rec));
+ dbuf.dptr = (uint8 *)SMB_MALLOC(len + sizeof(rec));
if (!dbuf.dptr) {
return NT_STATUS_NO_MEMORY;
}
@@ -323,7 +323,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
/* Not a new record. Check for duplicates. */
- for(ptr = (char *)old_dbuf.dptr; ptr < old_dbuf.dptr + old_dbuf.dsize; ) {
+ for(ptr = old_dbuf.dptr; ptr < old_dbuf.dptr + old_dbuf.dsize; ) {
/*
* First check if the message header matches, then, if it's a non-zero
* sized message, check if the data matches. If so it's a duplicate and
@@ -387,7 +387,7 @@ unsigned int messages_pending_for_pid(struct process_id pid)
{
TDB_DATA kbuf;
TDB_DATA dbuf;
- char *buf;
+ uint8 *buf;
unsigned int message_count = 0;
kbuf = message_key_pid(pid);
@@ -443,7 +443,7 @@ static BOOL retrieve_all_messages(char **msgs_buf, size_t *total_len)
return False;
}
- *msgs_buf = dbuf.dptr;
+ *msgs_buf = (char *)dbuf.dptr;
*total_len = dbuf.dsize;
return True;
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index 2348995dc8..5fa9fd7a7d 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -295,7 +295,7 @@ static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask )
/* no packing. static size structure, just write it out */
- data.dptr = (char*)mask;
+ data.dptr = (uint8 *)mask;
data.dsize = sizeof(SE_PRIV);
return ( tdb_store_bystring(tdb, keystr, data, TDB_REPLACE) != -1 );
@@ -482,7 +482,7 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s
/* check we have a PRIV_+SID entry */
- if ( strncmp(key.dptr, PRIVPREFIX, prefixlen) != 0)
+ if ( strncmp((const char *)key.dptr, PRIVPREFIX, prefixlen) != 0)
return 0;
/* check to see if we are looking for a particular privilege */
@@ -499,7 +499,7 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s
return 0;
}
- fstrcpy( sid_string, &key.dptr[strlen(PRIVPREFIX)] );
+ fstrcpy( sid_string, (const char *)&key.dptr[strlen(PRIVPREFIX)] );
/* this is a last ditch safety check to preventing returning
and invalid SID (i've somehow run into this on development branches) */
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 5f96580120..c6e3063d56 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -43,22 +43,22 @@ static void gotalarm_sig(void)
Make a TDB_DATA and keep the const warning in one place
****************************************************************/
-TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
+TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize)
{
TDB_DATA ret;
- ret.dptr = CONST_DISCARD(char *, dptr);
+ ret.dptr = CONST_DISCARD(uint8 *, dptr);
ret.dsize = dsize;
return ret;
}
TDB_DATA string_tdb_data(const char *string)
{
- return make_tdb_data(string, string ? strlen(string) : 0 );
+ return make_tdb_data((const uint8 *)string, string ? strlen(string) : 0 );
}
TDB_DATA string_term_tdb_data(const char *string)
{
- return make_tdb_data(string, string ? strlen(string) + 1 : 0);
+ return make_tdb_data((const uint8 *)string, string ? strlen(string) + 1 : 0);
}
/****************************************************************************
@@ -204,7 +204,7 @@ int tdb_store_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, int32 v)
int32 v_store;
SIVAL(&v_store,0,v);
- data.dptr = (char *)&v_store;
+ data.dptr = (uint8 *)&v_store;
data.dsize = sizeof(int32);
return tdb_store(tdb, key, data, TDB_REPLACE);
@@ -266,7 +266,7 @@ BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value)
BOOL ret = True;
SIVAL(&v_store, 0, value);
- data.dptr = (char *)&v_store;
+ data.dptr = (uint8 *)&v_store;
data.dsize = sizeof(uint32);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
@@ -417,7 +417,7 @@ BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldv
integers and strings.
****************************************************************************/
-size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
+size_t tdb_pack_va(uint8 *buf, int bufsize, const char *fmt, va_list ap)
{
uint8 bt;
uint16 w;
@@ -427,7 +427,7 @@ size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
int len;
char *s;
char c;
- char *buf0 = buf;
+ uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
@@ -501,7 +501,7 @@ size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
return PTR_DIFF(buf, buf0);
}
-size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...)
+size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
size_t result;
@@ -534,7 +534,7 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
}
va_start(ap, fmt);
- len2 = tdb_pack_va((char *)(*buf)+(*len), len1, fmt, ap);
+ len2 = tdb_pack_va((*buf)+(*len), len1, fmt, ap);
va_end(ap);
if (len1 != len2) {
@@ -551,7 +551,7 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
integers and strings.
****************************************************************************/
-int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
+int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
uint8 *bt;
@@ -562,7 +562,7 @@ int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
void **p;
char *s, **b;
char c;
- char *buf0 = buf;
+ const uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
@@ -605,14 +605,14 @@ int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
break;
case 'P':
s = va_arg(ap,char *);
- len = strlen(buf) + 1;
+ len = strlen((const char *)buf) + 1;
if (bufsize < len || len > sizeof(pstring))
goto no_space;
memcpy(s, buf, len);
break;
case 'f':
s = va_arg(ap,char *);
- len = strlen(buf) + 1;
+ len = strlen((const char *)buf) + 1;
if (bufsize < len || len > sizeof(fstring))
goto no_space;
memcpy(s, buf, len);
@@ -734,7 +734,7 @@ TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern)
for (key = tdb_firstkey(tdb); key.dptr; key = next) {
/* duplicate key string to ensure null-termination */
- char *key_str = SMB_STRNDUP(key.dptr, key.dsize);
+ char *key_str = SMB_STRNDUP((const char *)key.dptr, key.dsize);
if (!key_str) {
DEBUG(0, ("tdb_search_keys: strndup() failed!\n"));
smb_panic("strndup failed!\n");