Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use ftruncate() at the end of a --sparse file.
[rsync/rsync.git]
/
hashtable.c
diff --git
a/hashtable.c
b/hashtable.c
index
d5f1d11
..
ea858fb
100644
(file)
--- a/
hashtable.c
+++ b/
hashtable.c
@@
-41,7
+41,7
@@
struct hashtable *hashtable_create(int size, int key64)
tbl->size = size;
tbl->entries = 0;
tbl->node_size = node_size;
tbl->size = size;
tbl->entries = 0;
tbl->node_size = node_size;
- tbl->key64 =
(short)key64
;
+ tbl->key64 =
key64 ? 1 : 0
;
if (DEBUG_GTE(HASH, 1)) {
char buf[32];
if (DEBUG_GTE(HASH, 1)) {
char buf[32];
@@
-74,6
+74,11
@@
void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing)
struct ht_int32_node *node;
uint32 ndx;
struct ht_int32_node *node;
uint32 ndx;
+ if (key64 ? key == 0 : (int32)key == 0) {
+ rprintf(FERROR, "Internal hashtable error: illegal key supplied!\n");
+ exit_cleanup(RERR_MESSAGEIO);
+ }
+
if (allocate_if_missing && tbl->entries > HASH_LOAD_LIMIT(tbl->size)) {
void *old_nodes = tbl->nodes;
int size = tbl->size * 2;
if (allocate_if_missing && tbl->entries > HASH_LOAD_LIMIT(tbl->size)) {
void *old_nodes = tbl->nodes;
int size = tbl->size * 2;
@@
-106,7
+111,7
@@
void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing)
uchar buf[4], *keyp = buf;
int i;
uchar buf[4], *keyp = buf;
int i;
- SIVAL(buf, 0, key);
+ SIVAL
u
(buf, 0, key);
for (ndx = 0, i = 0; i < 4; i++) {
ndx += keyp[i];
ndx += (ndx << 10);
for (ndx = 0, i = 0; i < 4; i++) {
ndx += keyp[i];
ndx += (ndx << 10);