mirror of
https://github.com/samba-team/samba.git
synced 2024-12-29 11:21:54 +03:00
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 commit is contained in:
parent
30510f5007
commit
2943c69578
@ -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;
|
||||
|
||||
|
@ -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++) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user