diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-11-06 18:35:17 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-03-06 11:35:17 +0100 |
commit | e10fa46f3e5b3481e3c95e52f9d666eafd50ed25 (patch) | |
tree | 53637c911edbbf5fb5c16a42cb1816c3315ec6cc /source4/lib/ldb | |
parent | 24049e8fc58c5216b3af8fdaf327471eaff882a1 (diff) | |
download | samba-e10fa46f3e5b3481e3c95e52f9d666eafd50ed25.tar.gz samba-e10fa46f3e5b3481e3c95e52f9d666eafd50ed25.tar.bz2 samba-e10fa46f3e5b3481e3c95e52f9d666eafd50ed25.zip |
LDB:tools - change counters to be unsigned
In most cases we do count LDB objects which are enumerated within the "unsigned"
type. Therefore no need to use "signed" counters.
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/tools/cmdline.c | 4 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbadd.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbdel.c | 3 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 20 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 12 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 24 |
6 files changed, 38 insertions, 32 deletions
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index f2becb17af..869d5ca8c3 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -347,8 +347,8 @@ failed: */ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **request) { - int i, j; - int ret = 0; + unsigned int i, j; + int ret = 0; if (reply == NULL || request == NULL) return -1; diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index e618ab52f7..0dd35cc1b3 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -35,7 +35,7 @@ #include "tools/cmdline.h" #include "ldbutil.h" -static int failures; +static unsigned int failures; static struct ldb_cmdline *options; static void usage(void) @@ -50,7 +50,7 @@ static void usage(void) /* add records from an opened file */ -static int process_file(struct ldb_context *ldb, FILE *f, int *count) +static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count) { struct ldb_ldif *ldif; int ret = LDB_SUCCESS; @@ -93,7 +93,8 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) int main(int argc, const char **argv) { struct ldb_context *ldb; - int i, ret=0, count=0; + unsigned int i, count = 0; + int ret=0; ldb = ldb_init(NULL, NULL); diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index 1b8adf714c..04884e1bec 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -43,7 +43,8 @@ static int dn_cmp(struct ldb_message **msg1, struct ldb_message **msg2) static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls) { - int ret, i, total=0; + int ret; + unsigned int i, total=0; const char *attrs[] = { NULL }; struct ldb_result *res; diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index ecadf0f61c..4c5683cd83 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -88,10 +88,10 @@ static int modify_record(struct ldb_context *ldb, */ static struct ldb_message *msg_find(struct ldb_context *ldb, struct ldb_message **msgs, - int count, + unsigned int count, struct ldb_dn *dn) { - int i; + unsigned int i; for (i=0;i<count;i++) { if (ldb_dn_compare(dn, msgs[i]->dn) == 0) { return msgs[i]; @@ -104,10 +104,10 @@ static struct ldb_message *msg_find(struct ldb_context *ldb, merge the changes in msgs2 into the messages from msgs1 */ static int merge_edits(struct ldb_context *ldb, - struct ldb_message **msgs1, int count1, - struct ldb_message **msgs2, int count2) + struct ldb_message **msgs1, unsigned int count1, + struct ldb_message **msgs2, unsigned int count2) { - int i; + unsigned int i; struct ldb_message *msg; int ret = 0; int adds=0, modifies=0, deletes=0; @@ -171,9 +171,9 @@ static int merge_edits(struct ldb_context *ldb, save a set of messages as ldif to a file */ static int save_ldif(struct ldb_context *ldb, - FILE *f, struct ldb_message **msgs, int count) + FILE *f, struct ldb_message **msgs, unsigned int count) { - int i; + unsigned int i; fprintf(f, "# editing %d records\n", count); @@ -194,8 +194,8 @@ static int save_ldif(struct ldb_context *ldb, /* edit the ldb search results in msgs using the user selected editor */ -static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int count1, - const char *editor) +static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, + unsigned int count1, const char *editor) { int fd, ret; FILE *f; @@ -203,7 +203,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun char *cmd; struct ldb_ldif *ldif; struct ldb_message **msgs2 = NULL; - int count2 = 0; + unsigned int count2 = 0; /* write out the original set of messages to a temporary file */ diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index af0c12a84c..327a75ed8d 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -54,15 +54,15 @@ struct search_context { struct ldb_control **req_ctrls; int sort; - int num_stored; + unsigned int num_stored; struct ldb_message **store; - int refs_stored; + unsigned int refs_stored; char **refs_store; - int entries; - int refs; + unsigned int entries; + unsigned int refs; - int pending; + unsigned int pending; int status; }; @@ -240,7 +240,7 @@ again: goto again; if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) { - int i; + unsigned int i; if (sctx->num_stored) { LDB_TYPESAFE_QSORT(sctx->store, sctx->num_stored, ldb, do_compare_msg); diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index adc6ec8115..1c877c761a 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -52,10 +52,10 @@ static double _end_timer(void) static void add_records(struct ldb_context *ldb, struct ldb_dn *basedn, - int count) + unsigned int count) { struct ldb_message msg; - int i; + unsigned int i; #if 0 if (ldb_lock(ldb, "transaction") != 0) { @@ -141,10 +141,10 @@ static void add_records(struct ldb_context *ldb, static void modify_records(struct ldb_context *ldb, struct ldb_dn *basedn, - int count) + unsigned int count) { struct ldb_message msg; - int i; + unsigned int i; for (i=0;i<count;i++) { struct ldb_message_element el[3]; @@ -194,9 +194,9 @@ static void modify_records(struct ldb_context *ldb, static void delete_records(struct ldb_context *ldb, struct ldb_dn *basedn, - int count) + unsigned int count) { - int i; + unsigned int i; for (i=0;i<count;i++) { struct ldb_dn *dn; @@ -217,9 +217,10 @@ static void delete_records(struct ldb_context *ldb, printf("\n"); } -static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nrecords, int nsearches) +static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, + unsigned int nrecords, unsigned int nsearches) { - int i; + unsigned int i; for (i=0;i<nsearches;i++) { int uid = (i * 700 + 17) % (nrecords * 2); @@ -250,7 +251,8 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco printf("\n"); } -static void start_test(struct ldb_context *ldb, int nrecords, int nsearches) +static void start_test(struct ldb_context *ldb, unsigned int nrecords, + unsigned int nsearches) { struct ldb_dn *basedn; @@ -411,7 +413,9 @@ int main(int argc, const char **argv) printf("Testing with num-records=%d and num-searches=%d\n", options->num_records, options->num_searches); - start_test(ldb, options->num_records, options->num_searches); + start_test(ldb, + (unsigned int) options->num_records, + (unsigned int) options->num_searches); start_test_index(&ldb); |