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 | |
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)
-rw-r--r-- | source3/include/hash.h | 4 | ||||
-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 | ||||
-rw-r--r-- | source3/smbd/dosmode.c | 2 | ||||
-rw-r--r-- | source3/smbd/mangle_hash2.c | 8 |
9 files changed, 20 insertions, 19 deletions
diff --git a/source3/include/hash.h b/source3/include/hash.h index c327c971ab..40cc8b7cab 100644 --- a/source3/include/hash.h +++ b/source3/include/hash.h @@ -66,8 +66,8 @@ typedef struct hash_element { typedef struct hash_table { ubi_dlList *buckets; ubi_dlList lru_chain; - int num_elements; - int size; + unsigned num_elements; + unsigned size; compare_function comp_func; } hash_table; 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) { diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 77d8c9cc92..6c21dc04d0 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -181,7 +181,7 @@ uint32 dos_mode(connection_struct *conn,char *path,SMB_STRUCT_STAT *sbuf) /******************************************************************* chmod a file - but preserve some bits ********************************************************************/ -int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *st) +int file_chmod(connection_struct *conn,char *fname, uint32 dosmode,SMB_STRUCT_STAT *st) { SMB_STRUCT_STAT st1; int mask=0; diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index bbc9020eab..eda509214d 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -203,7 +203,7 @@ static const char *cache_lookup(u32 hash) */ static BOOL is_mangled_component(const char *name) { - int len, i; + unsigned int len, i; M_DEBUG(10,("is_mangled_component %s ?\n", name)); @@ -368,7 +368,7 @@ static void mangle_reset(void) static BOOL check_cache(char *name) { u32 hash, multiplier; - int i; + unsigned int i; const char *prefix; char extension[4]; @@ -489,8 +489,8 @@ static void name_map(char *name, BOOL need83, BOOL cache83) char *dot_p; char lead_chars[7]; char extension[4]; - int extension_length, i; - int prefix_len; + unsigned int extension_length, i; + unsigned int prefix_len; u32 hash, v; char new_name[13]; |