diff options
author | Martin Schwenke <martin@meltin.net> | 2019-05-28 10:57:49 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2019-06-05 10:25:49 +0000 |
commit | 9869ac1fb7677267426979ab9dadefffe501b84c (patch) | |
tree | 9b162059c3c07698f0bbda14234510ebd9aa26a9 /ctdb/tools | |
parent | 282221b0d64314f40b92651ffb41a95e01a1267a (diff) | |
download | samba-9869ac1fb7677267426979ab9dadefffe501b84c.tar.gz |
ctdb-tools: Fix signed/unsigned conversion by declaring as size_t
All the top-level callers pass size_t.
Drop the ternary operator. The value of hsize is always positive
because it is unsigned.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ltdbtool.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ctdb/tools/ltdbtool.c b/ctdb/tools/ltdbtool.c index d33480ce8fe..98a1b516751 100644 --- a/ctdb/tools/ltdbtool.c +++ b/ctdb/tools/ltdbtool.c @@ -96,7 +96,7 @@ static int usage(const char* cmd) static int ltdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT*, TDB_DATA, TDB_DATA, struct ctdb_ltdb_header*, void *), - void *state, int hsize, bool skip_empty); + void *state, size_t hsize, bool skip_empty); struct write_record_ctx { TDB_CONTEXT* tdb; @@ -125,7 +125,10 @@ static void dump_header_nop(struct dump_record_ctx* c, struct ctdb_ltdb_header* h) {} -static int dump_db(const char* iname, FILE* ofile, int hsize, bool dump_header, +static int dump_db(const char* iname, + FILE* ofile, + size_t hsize, + bool dump_header, bool empty) { int ret = -1; @@ -307,12 +310,12 @@ ltdb_traverse_fn(TDB_CONTEXT* tdb, TDB_DATA key, TDB_DATA val, static int ltdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT*, TDB_DATA, TDB_DATA, struct ctdb_ltdb_header*, void *), - void *state, int hsize, bool skip_empty) + void *state, size_t hsize, bool skip_empty) { struct ltdb_traverse_ctx ctx = { .fn = fn, .state = state, - .hsize = hsize < 0 ? sizeof(struct ctdb_ltdb_header) : hsize, + .hsize = hsize, .skip_empty = skip_empty, .nempty = 0, }; |