summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-08 13:27:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:41 -0500
commitdccf3f99e45137b6cd18c1de1c79808ad67130d1 (patch)
tree7c0f8e64f4ded3701818b8968171597eccd62267 /source4/lib
parentffeee68e4b72dd94fee57366bd8d38b8c284c3d4 (diff)
downloadsamba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.tar.gz
samba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.tar.bz2
samba-dccf3f99e45137b6cd18c1de1c79808ad67130d1.zip
r25027: Fix more warnings.
(This used to be commit 5085c53fcfade614e83d21fc2c1a5bc43bb2a729)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/charset/charcnv.c6
-rw-r--r--source4/lib/charset/util_unistr.c12
-rw-r--r--source4/lib/events/events_epoll.c2
-rw-r--r--source4/lib/smbreadline/smbreadline.c1
-rw-r--r--source4/lib/socket/socket.c2
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c4
-rw-r--r--source4/lib/tls/tls.c1
-rw-r--r--source4/lib/util/data_blob.c10
-rw-r--r--source4/lib/util/dprintf.c2
-rw-r--r--source4/lib/util/util_tdb.c5
-rw-r--r--source4/lib/util/xfile.c2
11 files changed, 25 insertions, 22 deletions
diff --git a/source4/lib/charset/charcnv.c b/source4/lib/charset/charcnv.c
index dda9f754b1..ca96277679 100644
--- a/source4/lib/charset/charcnv.c
+++ b/source4/lib/charset/charcnv.c
@@ -152,7 +152,7 @@ _PUBLIC_ ssize_t convert_string(charset_t from, charset_t to,
smb_iconv_t descriptor;
if (srclen == (size_t)-1)
- srclen = strlen(src)+1;
+ srclen = strlen(inbuf)+1;
descriptor = get_conv_handle(from, to);
@@ -351,9 +351,9 @@ static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t s
if (flags & (STR_TERMINATE | STR_TERMINATE_ASCII)) {
if (src_len == (size_t)-1) {
- src_len = strlen(src) + 1;
+ src_len = strlen((const char *)src) + 1;
} else {
- size_t len = strnlen(src, src_len);
+ size_t len = strnlen((const char *)src, src_len);
if (len < src_len)
len++;
src_len = len;
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c
index 6c86b0b899..e9cca090cc 100644
--- a/source4/lib/charset/util_unistr.c
+++ b/source4/lib/charset/util_unistr.c
@@ -393,7 +393,7 @@ _PUBLIC_ char *strchr_m(const char *s, char c)
size_t size;
codepoint_t c2 = next_codepoint(s, &size);
if (c2 == c) {
- return discard_const(s);
+ return discard_const_p(char, s);
}
s += size;
}
@@ -418,7 +418,7 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
size_t size;
codepoint_t c2 = next_codepoint(s, &size);
if (c2 == c) {
- ret = discard_const(s);
+ ret = discard_const_p(char, s);
}
s += size;
}
@@ -482,7 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
- dest = talloc_size(ctx, 2*(strlen(src))+1);
+ dest = talloc_array(ctx, char, 2*(strlen(src))+1);
if (dest == NULL) {
return NULL;
}
@@ -505,7 +505,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
dest[size] = 0;
/* trim it so talloc_append_string() works */
- dest = talloc_realloc_size(ctx, dest, size+1);
+ dest = talloc_realloc(ctx, dest, char, size+1);
talloc_set_name_const(dest, dest);
@@ -526,7 +526,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
- dest = talloc_size(ctx, 2*(strlen(src))+1);
+ dest = talloc_array(ctx, char, 2*(strlen(src))+1);
if (dest == NULL) {
return NULL;
}
@@ -549,7 +549,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
dest[size] = 0;
/* trim it so talloc_append_string() works */
- dest = talloc_realloc_size(ctx, dest, size+1);
+ dest = talloc_realloc(ctx, dest, char, size+1);
talloc_set_name_const(dest, dest);
diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c
index acd204c898..e2212e5333 100644
--- a/source4/lib/events/events_epoll.c
+++ b/source4/lib/events/events_epoll.c
@@ -56,7 +56,7 @@ struct epoll_event_context {
called when a epoll call fails, and we should fallback
to using select
*/
-static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason)
+_NORETURN_ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason)
{
DEBUG(0,("%s (%s) - calling abort()\n", reason, strerror(errno)));
abort();
diff --git a/source4/lib/smbreadline/smbreadline.c b/source4/lib/smbreadline/smbreadline.c
index ae9fc4a3b7..2a72750efb 100644
--- a/source4/lib/smbreadline/smbreadline.c
+++ b/source4/lib/smbreadline/smbreadline.c
@@ -23,6 +23,7 @@
#include "system/filesys.h"
#include "system/select.h"
#include "system/readline.h"
+#include "lib/smbreadline/smbreadline.h"
/*******************************************************************
Similar to sys_select() but catch EINTR and continue.
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 640d195d27..184c89f3ed 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -408,7 +408,7 @@ _PUBLIC_ struct socket_address *socket_address_from_sockaddr(TALLOC_CTX *mem_ctx
addr->family = NULL;
addr->addr = NULL;
addr->port = 0;
- addr->sockaddr = talloc_memdup(addr, sockaddr, sockaddrlen);
+ addr->sockaddr = (struct sockaddr *)talloc_memdup(addr, sockaddr, sockaddrlen);
if (!addr->sockaddr) {
talloc_free(addr);
return NULL;
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c
index ec074ecaeb..8458c61592 100644
--- a/source4/lib/socket_wrapper/socket_wrapper.c
+++ b/source4/lib/socket_wrapper/socket_wrapper.c
@@ -232,7 +232,7 @@ const char *socket_wrapper_dir(void)
return s;
}
-unsigned int socket_wrapper_default_iface(void)
+static unsigned int socket_wrapper_default_iface(void)
{
const char *s = getenv("SOCKET_WRAPPER_DEFAULT_IFACE");
if (s) {
@@ -1288,7 +1288,7 @@ _PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
return -1;
}
- my_addr = malloc(my_addrlen);
+ my_addr = (struct sockaddr *)malloc(my_addrlen);
if (my_addr == NULL) {
return -1;
}
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
index bfe144a011..3f148ff7bf 100644
--- a/source4/lib/tls/tls.c
+++ b/source4/lib/tls/tls.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
+#include "lib/tls/tls.h"
#if ENABLE_GNUTLS
#include "gnutls/gnutls.h"
diff --git a/source4/lib/util/data_blob.c b/source4/lib/util/data_blob.c
index 117043f95c..b258e47bba 100644
--- a/source4/lib/util/data_blob.c
+++ b/source4/lib/util/data_blob.c
@@ -39,9 +39,9 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
}
if (p) {
- ret.data = talloc_memdup(NULL, p, length);
+ ret.data = (uint8_t *)talloc_memdup(NULL, p, length);
} else {
- ret.data = talloc_size(NULL, length);
+ ret.data = talloc_array(NULL, uint8_t, length);
}
if (ret.data == NULL) {
ret.length = 0;
@@ -175,7 +175,7 @@ _PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
_PUBLIC_ DATA_BLOB data_blob_string_const(const char *str)
{
DATA_BLOB blob;
- blob.data = discard_const(str);
+ blob.data = discard_const_p(uint8_t, str);
blob.length = strlen(str);
return blob;
}
@@ -187,7 +187,7 @@ _PUBLIC_ DATA_BLOB data_blob_string_const(const char *str)
_PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
{
DATA_BLOB blob;
- blob.data = discard_const(p);
+ blob.data = discard_const_p(uint8_t, p);
blob.length = length;
return blob;
}
@@ -198,7 +198,7 @@ _PUBLIC_ DATA_BLOB data_blob_const(const void *p, size_t length)
**/
_PUBLIC_ bool data_blob_realloc(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t length)
{
- blob->data = talloc_realloc_size(mem_ctx, blob->data, length);
+ blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, length);
if (blob->data == NULL)
return false;
blob->length = length;
diff --git a/source4/lib/util/dprintf.c b/source4/lib/util/dprintf.c
index a7770f364d..91665e7bdd 100644
--- a/source4/lib/util/dprintf.c
+++ b/source4/lib/util/dprintf.c
@@ -48,7 +48,7 @@ _PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBU
charset, but beware of it growing */
maxlen = ret*2;
again:
- p2 = malloc(maxlen);
+ p2 = (char *)malloc(maxlen);
if (!p2) {
SAFE_FREE(p);
return -1;
diff --git a/source4/lib/util/util_tdb.c b/source4/lib/util/util_tdb.c
index 1112f1587c..d7bddbde01 100644
--- a/source4/lib/util/util_tdb.c
+++ b/source4/lib/util/util_tdb.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "lib/tdb/include/tdb.h"
#include "pstring.h"
+#include "lib/util/util_tdb.h"
/* these are little tdb utility functions that are meant to make
dealing with a tdb database a little less cumbersome in Samba */
@@ -127,7 +128,7 @@ int tdb_store_int32_byblob(struct tdb_context *tdb, const char *keystr, size_t l
int32_t v_store;
SIVAL(&v_store,0,v);
- data.dptr = (void *)&v_store;
+ data.dptr = (unsigned char *)&v_store;
data.dsize = sizeof(int32_t);
return tdb_store(tdb, key, data, TDB_REPLACE);
@@ -187,7 +188,7 @@ bool tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t
bool ret = true;
SIVAL(&v_store, 0, value);
- data.dptr = (void *)&v_store;
+ data.dptr = (unsigned char *)&v_store;
data.dsize = sizeof(uint32_t);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
diff --git a/source4/lib/util/xfile.c b/source4/lib/util/xfile.c
index 8b90e30868..a016031a77 100644
--- a/source4/lib/util/xfile.c
+++ b/source4/lib/util/xfile.c
@@ -85,7 +85,7 @@ static int x_allocate_buffer(XFILE *f)
{
if (f->buf) return 1;
if (f->bufsize == 0) return 0;
- f->buf = malloc(f->bufsize);
+ f->buf = (char *)malloc(f->bufsize);
if (!f->buf) return 0;
f->next = f->buf;
return 1;