summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-04-17 12:27:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:23 -0500
commit76e581b983989377d3ac3ae89b2b7d925aadc3f5 (patch)
tree0973275cef43fef24af3d07530f4464ec0702427
parent4f240462949ca7487b111adf7aef249f4c6f6e8d (diff)
downloadsamba-76e581b983989377d3ac3ae89b2b7d925aadc3f5.tar.gz
samba-76e581b983989377d3ac3ae89b2b7d925aadc3f5.tar.bz2
samba-76e581b983989377d3ac3ae89b2b7d925aadc3f5.zip
r15103: Okay, looking closer: Samba4 tdb not exporting u32 is a bug in samba4's
tdb. tdb_open_ex needs it. Can someone from samba4 tell me how this should be handled? Thanks, Volker (This used to be commit 0a2f1ed5e9012e07ef158666b68994d0961768b6)
-rw-r--r--source3/smbd/mangle_hash2.c24
-rw-r--r--source3/smbd/statcache.c6
2 files changed, 15 insertions, 15 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index ec17109422..0a161c9e76 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -101,7 +101,7 @@ static unsigned mangle_prefix;
hashing the resulting cache entry to match the known hash
*/
static char **prefix_cache;
-static uint32 *prefix_cache_hashes;
+static u32 *prefix_cache_hashes;
/* these are the characters we use in the 8.3 hash. Must be 36 chars long */
static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -119,10 +119,10 @@ static const char *reserved_names[] =
this hash needs to be fast with a low collision rate (what hash doesn't?)
*/
-static uint32 mangle_hash(const char *key, unsigned int length)
+static u32 mangle_hash(const char *key, unsigned int length)
{
- uint32 value;
- uint32 i;
+ u32 value;
+ u32 i;
fstring str;
/* we have to uppercase here to ensure that the mangled name
@@ -139,8 +139,8 @@ static uint32 mangle_hash(const char *key, unsigned int length)
/* Set the initial value from the key size. */
for (value = FNV1_INIT, i=0; i < length; i++) {
- value *= (uint32)FNV1_PRIME;
- value ^= (uint32)(str[i]);
+ value *= (u32)FNV1_PRIME;
+ value ^= (u32)(str[i]);
}
/* note that we force it to a 31 bit hash, to keep within the limits
@@ -162,7 +162,7 @@ static BOOL cache_init(void)
return False;
}
- prefix_cache_hashes = SMB_CALLOC_ARRAY(uint32, MANGLE_CACHE_SIZE);
+ prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE);
if (!prefix_cache_hashes) {
return False;
}
@@ -173,7 +173,7 @@ static BOOL cache_init(void)
/*
insert an entry into the prefix cache. The string might not be null
terminated */
-static void cache_insert(const char *prefix, int length, uint32 hash)
+static void cache_insert(const char *prefix, int length, u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -188,7 +188,7 @@ static void cache_insert(const char *prefix, int length, uint32 hash)
/*
lookup an entry in the prefix cache. Return NULL if not found.
*/
-static const char *cache_lookup(uint32 hash)
+static const char *cache_lookup(u32 hash)
{
int i = hash % MANGLE_CACHE_SIZE;
@@ -372,7 +372,7 @@ static void mangle_reset(void)
*/
static BOOL check_cache(char *name, size_t maxlen, int snum)
{
- uint32 hash, multiplier;
+ u32 hash, multiplier;
unsigned int i;
const char *prefix;
char extension[4];
@@ -386,7 +386,7 @@ static BOOL check_cache(char *name, size_t maxlen, int snum)
/* we need to extract the hash from the 8.3 name */
hash = base_reverse[(unsigned char)name[7]];
for (multiplier=36, i=5;i>=mangle_prefix;i--) {
- uint32 v = base_reverse[(unsigned char)name[i]];
+ u32 v = base_reverse[(unsigned char)name[i]];
hash += multiplier * v;
multiplier *= 36;
}
@@ -517,7 +517,7 @@ static void name_map(fstring name, BOOL need83, BOOL cache83, int default_case,
char extension[4];
unsigned int extension_length, i;
unsigned int prefix_len;
- uint32 hash, v;
+ u32 hash, v;
char new_name[13];
/* reserved names are handled specially */
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index fe022017b5..548d7c4a48 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -291,12 +291,12 @@ BOOL stat_cache_lookup(connection_struct *conn, pstring name, pstring dirpath,
JRA. Use a djb-algorithm hash for speed.
***************************************************************/
-uint32 fast_string_hash(TDB_DATA *key)
+u32 fast_string_hash(TDB_DATA *key)
{
- uint32 n = 0;
+ u32 n = 0;
const char *p;
for (p = key->dptr; *p != '\0'; p++) {
- n = ((n << 5) + n) ^ (uint32)(*p);
+ n = ((n << 5) + n) ^ (u32)(*p);
}
return n;
}