In most cases we do count LDB objects which are enumerated within the "unsigned"
type. Therefore no need to use "signed" counters.
*/
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;
#include "tools/cmdline.h"
#include "ldbutil.h"
-static int failures;
+static unsigned int failures;
static struct ldb_cmdline *options;
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;
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);
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;
*/
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];
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;
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);
/*
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;
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 */
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;
};
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);
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) {
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];
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;
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);
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;
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);