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;
#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};
/****************************************************************************
****************************************************************************
*/
-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;
{
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))) {
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++) {
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);
****************************************************************************/
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);
}
if (fd == -1) {
return False;
}
- if (write(fd, packet, length) != length) {
+ if (write(fd, packet, length) != (size_t)length) {
return False;
}
close(fd);
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
}
/* 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 ||
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) {
/*******************************************************************
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;
*/
static BOOL is_mangled_component(const char *name)
{
- int len, i;
+ unsigned int len, i;
M_DEBUG(10,("is_mangled_component %s ?\n", name));
static BOOL check_cache(char *name)
{
u32 hash, multiplier;
- int i;
+ unsigned int i;
const char *prefix;
char extension[4];
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];