summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-18 20:10:17 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-18 20:14:56 +0200
commit48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044 (patch)
tree09c3bdc8dbb9048ae65276b4e2aaefccb7700e94 /source4/lib/ldb
parent94a445869c5fa3bb6df542c494e8822478f790e8 (diff)
downloadsamba-48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044.tar.gz
samba-48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044.tar.bz2
samba-48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044.zip
ldb:ldb_tdb.c - fix up counter variables
"find_element" returns an "int" since there is also the possibility that a certain element doesn't exist - then "-1" is returned. But beside this exception treat all other return values as unsigned.
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index a92f1dca9e..435053703e 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -548,7 +548,8 @@ static int msg_delete_element(struct ldb_module *module,
return LDB_ERR_NO_SUCH_ATTRIBUTE;
}
- el = &msg->elements[found];
+ i = (unsigned int) found;
+ el = &(msg->elements[i]);
a = ldb_schema_attribute_by_name(ldb, el->name);
@@ -608,7 +609,7 @@ int ltdb_modify_internal(struct ldb_module *module,
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
TDB_DATA tdb_key, tdb_data;
struct ldb_message *msg2;
- unsigned i, j, k;
+ unsigned int i, j, k;
int ret = LDB_SUCCESS, idx;
struct ldb_control *control_permissive = NULL;
@@ -698,7 +699,8 @@ int ltdb_modify_internal(struct ldb_module *module,
goto done;
}
} else {
- el2 = &(msg2->elements[idx]);
+ j = (unsigned int) idx;
+ el2 = &(msg2->elements[j]);
/* Check that values don't exist yet on multi-
valued attributes or aren't provided twice */
@@ -773,7 +775,8 @@ int ltdb_modify_internal(struct ldb_module *module,
/* Checks if element already exists */
idx = find_element(msg2, el->name);
if (idx != -1) {
- el2 = &(msg2->elements[idx]);
+ j = (unsigned int) idx;
+ el2 = &(msg2->elements[j]);
if (ldb_msg_element_compare(el, el2) == 0) {
/* we are replacing with the same values */
continue;
@@ -1274,7 +1277,7 @@ static int ltdb_handle_request(struct ldb_module *module,
struct ltdb_context *ac;
struct tevent_timer *te;
struct timeval tv;
- int i;
+ unsigned int i;
ldb = ldb_module_get_ctx(module);