X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Fcheck.c;h=eb8ddcae79baba5ba8f0fa8a5b4e908b4332f105;hp=cb864ab74ff5a34707199ef374bdc67fede666e9;hb=d1cea3ebf96f61b5bbac1e74975700770e06add6;hpb=86028553af9bac5bca6aebf5f9d29b1494c8c446 diff --git a/ccan/tdb2/check.c b/ccan/tdb2/check.c index cb864ab7..eb8ddcae 100644 --- a/ccan/tdb2/check.c +++ b/ccan/tdb2/check.c @@ -45,14 +45,15 @@ static bool check_header(struct tdb_context *tdb) 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; } @@ -263,7 +264,7 @@ static bool check_hash(struct tdb_context *tdb, 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) { @@ -336,11 +337,11 @@ static tdb_len_t check_free_list(struct tdb_context *tdb, h = bucket_off(zone_off, i); for (off = tdb_read_off(tdb, h); off; off = f.next) { if (off == TDB_OFF_ERR) - return false; + return TDB_OFF_ERR; if (tdb_read_convert(tdb, off, &f, sizeof(f))) - return false; + return TDB_OFF_ERR; if (!check_free(tdb, off, &f, prev, zone_off, i)) - return false; + return TDB_OFF_ERR; /* FIXME: Check hash bits */ p = asearch(&off, free, num_free, off_cmp); @@ -350,7 +351,7 @@ static tdb_len_t check_free_list(struct tdb_context *tdb, "tdb_check: Invalid offset" " %llu in free table\n", (long long)off); - return false; + return TDB_OFF_ERR; } /* Mark it invalid. */ *p ^= 1;