diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-02-22 12:22:06 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-02-22 12:22:06 +0000 |
commit | 7e110f782a55d4dca1fb3fedd95bf059c9ec0638 (patch) | |
tree | 2e27934bd9c23ed79a80d9ea4a02396cd0516b3c /source3/lib | |
parent | 0dde23a7b24edf1cbf4d7d7e5afea485e37498e5 (diff) | |
download | samba-7e110f782a55d4dca1fb3fedd95bf059c9ec0638.tar.gz samba-7e110f782a55d4dca1fb3fedd95bf059c9ec0638.tar.bz2 samba-7e110f782a55d4dca1fb3fedd95bf059c9ec0638.zip |
More signed/unsigned fixes (yes, I run with funny compiler options) and
make x_fwrite() match fwrite() in returning a size_t.
Andrew Bartlett
(This used to be commit 2943c695787b742e9a96b2eefe2d75f681bacf7c)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/hash.c | 10 | ||||
-rw-r--r-- | source3/lib/pidfile.c | 2 | ||||
-rw-r--r-- | source3/lib/time.c | 2 | ||||
-rw-r--r-- | source3/lib/util_file.c | 2 | ||||
-rw-r--r-- | source3/lib/util_seaccess.c | 2 | ||||
-rw-r--r-- | source3/lib/xfile.c | 7 |
6 files changed, 13 insertions, 12 deletions
diff --git a/source3/lib/hash.c b/source3/lib/hash.c index 6b7a8476b1..95af485707 100644 --- a/source3/lib/hash.c +++ b/source3/lib/hash.c @@ -28,7 +28,7 @@ #include "includes.h" static BOOL enlarge_hash_table(hash_table *table); -static int primes[] = +static unsigned primes[] = {17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 16411}; /**************************************************************************** @@ -47,9 +47,9 @@ static int primes[] = **************************************************************************** */ -BOOL hash_table_init(hash_table *table, int num_buckets, compare_function compare_func) +BOOL hash_table_init(hash_table *table, unsigned num_buckets, compare_function compare_func) { - int i; + unsigned i; ubi_dlList *bucket; table->num_elements = 0; @@ -118,7 +118,7 @@ static hash_element *hash_chain_find(hash_table *table, ubi_dlList *hash_chain, { hash_element *hash_elem; ubi_dlNodePtr lru_item; - int i = 0; + unsigned int i = 0; for (hash_elem = (hash_element *)(ubi_dlFirst(hash_chain)); i < hash_chain->count; i++, hash_elem = (hash_element *)(ubi_dlNext(hash_elem))) { @@ -299,7 +299,7 @@ static BOOL enlarge_hash_table(hash_table *table) void hash_clear(hash_table *table) { - int i; + unsigned int i; ubi_dlList *bucket = table->buckets; hash_element *hash_elem; for (i = 0; i < table->size; bucket++, i++) { diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 16a12656b3..1a462bf128 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -100,7 +100,7 @@ void pidfile_create(const char *name) memset(buf, 0, sizeof(buf)); slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid()); - if (write(fd, buf, strlen(buf)) != strlen(buf)) { + if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) { DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile, strerror(errno))); exit(1); diff --git a/source3/lib/time.c b/source3/lib/time.c index ea5c6837bf..f76a1bdc0d 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -479,7 +479,7 @@ check if it's a null mtime ****************************************************************************/ BOOL null_mtime(time_t mtime) { - if (mtime == 0 || mtime == 0xFFFFFFFF || mtime == (time_t)-1) + if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1) return(True); return(False); } diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 4babab8931..02acbd4d7e 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -593,7 +593,7 @@ BOOL file_save(const char *fname, void *packet, size_t length) if (fd == -1) { return False; } - if (write(fd, packet, length) != length) { + if (write(fd, packet, length) != (size_t)length) { return False; } close(fd); diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c index 21d7fe8599..eba8cab7fb 100644 --- a/source3/lib/util_seaccess.c +++ b/source3/lib/util_seaccess.c @@ -343,7 +343,7 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, SEC_DESC *sd; SEC_ACL *new_dacl, *the_acl; SEC_ACE *new_ace_list = NULL; - int new_ace_list_ndx = 0, i; + unsigned int new_ace_list_ndx = 0, i; size_t size; /* Currently we only process the dacl when creating the child. The diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index 57f3e27638..1534dd855e 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -140,9 +140,10 @@ int x_fclose(XFILE *f) } /* simulate fwrite() */ -int x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) +size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) { - int ret, total=0; + ssize_t ret; + size_t total=0; /* we might be writing unbuffered */ if (f->buftype == X_IONBF || @@ -154,7 +155,7 @@ int x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) while (total < size*nmemb) { - int n = f->bufsize - f->bufused; + size_t n = f->bufsize - f->bufused; n = MIN(n, (size*nmemb)-total); if (n == 0) { |