if (hdr.hash_test != hash_test) {
tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
"check: hash test %llu should be %llu\n",
- hdr.hash_test, hash_test);
+ (long long)hdr.hash_test,
+ (long long)hash_test);
return false;
}
if (strcmp(hdr.magic_food, TDB_MAGIC_FOOD) != 0) {
tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
"check: bad magic '%.*s'\n",
- sizeof(hdr.magic_food), hdr.magic_food);
+ (unsigned)sizeof(hdr.magic_food), hdr.magic_food);
return false;
}
if (!check_hash_tree(tdb, offsetof(struct tdb_header, hashtable),
TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS,
- 0, 0, used, num_used, &num_found))
+ 0, 0, used, num_used, &num_found))
return false;
if (num_found != num_used) {
/* Return 1 if we find something, 0 if not, -1 on error. */
int next_in_hash(struct tdb_context *tdb, int ltype,
struct traverse_info *tinfo,
- TDB_DATA *kbuf, unsigned int *dlen)
+ TDB_DATA *kbuf, size_t *dlen)
{
const unsigned group_bits = TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS;
tdb_off_t hlock_start, hlock_range, off;
/* Return 1 if we find something, 0 if not, -1 on error. */
int first_in_hash(struct tdb_context *tdb, int ltype,
struct traverse_info *tinfo,
- TDB_DATA *kbuf, unsigned int *dlen)
+ TDB_DATA *kbuf, size_t *dlen)
{
tinfo->prev = 0;
tinfo->toplevel_group = 0;
tdb->ecode = TDB_ERR_IO;
tdb->log(tdb, TDB_DEBUG_FATAL, tdb->log_priv,
"tdb_write failed at %llu len=%llu (%s)\n",
- off, len, strerror(errno));
+ (long long)off, (long long)len,
+ strerror(errno));
return -1;
}
}
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
+#include <stddef.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <unistd.h>
typedef uint64_t tdb_len_t;
typedef uint64_t tdb_off_t;
-#ifndef offsetof
-#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
-#endif
-
#define TDB_MAGIC_FOOD "TDB file\n"
#define TDB_VERSION ((uint64_t)(0x26011967 + 7))
#define TDB_MAGIC ((uint64_t)0x1999)