summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-11-06 18:35:17 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-08 10:32:56 +0100
commit2d03011858ca33ee56b4c36ac6a901850ff69864 (patch)
treec4d733c6f4d2aadf72e9486f182e7c3db6a8d430 /source4/lib/ldb
parent4a2b78a6f36d4eb2a8763464f33720936921650c (diff)
downloadsamba-2d03011858ca33ee56b4c36ac6a901850ff69864.tar.gz
samba-2d03011858ca33ee56b4c36ac6a901850ff69864.tar.bz2
samba-2d03011858ca33ee56b4c36ac6a901850ff69864.zip
LDB:TDB backend - change counter variables to "unsigned" where appropriate
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c11
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c12
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c5
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c5
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.h2
5 files changed, 19 insertions, 16 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index aa19f75e9c..2f0ba22268 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -60,7 +60,7 @@ static void ltdb_attributes_unload(struct ldb_module *module)
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
struct ldb_message *msg;
- int i;
+ unsigned int i;
ldb = ldb_module_get_ctx(module);
@@ -83,10 +83,10 @@ static void ltdb_attributes_unload(struct ldb_module *module)
*/
static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v)
{
- int i;
+ unsigned int i;
unsigned value = 0;
for (i=0;i<el->num_values;i++) {
- int j;
+ unsigned int j;
for (j=0;ltdb_valid_attr_flags[j].name;j++) {
if (strcmp(ltdb_valid_attr_flags[j].name,
(char *)el->values[i].data) == 0) {
@@ -112,7 +112,8 @@ static int ltdb_attributes_load(struct ldb_module *module)
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
struct ldb_message *msg = ltdb->cache->attributes;
struct ldb_dn *dn;
- int i, r;
+ unsigned int i;
+ int r;
ldb = ldb_module_get_ctx(module);
@@ -480,7 +481,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
int ltdb_check_at_attributes_values(const struct ldb_val *value)
{
- int i;
+ unsigned int i;
for (i = 0; ltdb_valid_attr_flags[i].name != NULL; i++) {
if ((strcmp(ltdb_valid_attr_flags[i].name, (char *)value->data) == 0)) {
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index bb4617db09..c9c3e0c211 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -76,7 +76,7 @@ static int dn_list_cmp(const struct ldb_val *v1, const struct ldb_val *v2)
*/
static int ltdb_dn_list_find_val(const struct dn_list *list, const struct ldb_val *v)
{
- int i;
+ unsigned int i;
for (i=0; i<list->count; i++) {
if (dn_list_cmp(&list->dn[i], v) == 0) return i;
}
@@ -967,7 +967,7 @@ static int ltdb_index_filter(const struct dn_list *dn_list,
*/
static void ltdb_dn_list_remove_duplicates(struct dn_list *list)
{
- int i, new_count;
+ unsigned int i, new_count;
if (list->count < 2) {
return;
@@ -1279,12 +1279,13 @@ int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg)
delete an index entry for one message element
*/
int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
- struct ldb_message_element *el, int v_idx)
+ struct ldb_message_element *el, unsigned int v_idx)
{
struct ldb_context *ldb;
struct ldb_dn *dn_key;
const char *dn_str;
int ret, i;
+ unsigned int j;
struct dn_list *list;
ldb = ldb_module_get_ctx(module);
@@ -1329,9 +1330,8 @@ int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
return LDB_SUCCESS;
}
- if (i != list->count-1) {
- memmove(&list->dn[i], &list->dn[i+1], sizeof(list->dn[0])*(list->count - (i+1)));
- }
+ j = (unsigned int) i;
+ memmove(&list->dn[j], &list->dn[j+1], sizeof(list->dn[0])*(list->count - (i+1)));
list->count--;
list->dn = talloc_realloc(list, list->dn, struct ldb_val, list->count);
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 268c2f3c35..efd6968ceb 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -145,7 +145,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
const char * const *attrs)
{
struct ldb_message *ret;
- int i;
+ unsigned int i;
ret = talloc(mem_ctx, struct ldb_message);
if (!ret) {
@@ -325,7 +325,8 @@ int ltdb_add_attr_results(struct ldb_module *module,
*/
int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
{
- int i, keep_all = 0;
+ unsigned int i;
+ int keep_all = 0;
if (attrs) {
/* check for special attrs */
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index fc9a949a41..cf625385cb 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -176,7 +176,7 @@ static int ltdb_check_special_dn(struct ldb_module *module,
const struct ldb_message *msg)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
- int i, j;
+ unsigned int i, j;
if (! ldb_dn_is_special(msg->dn) ||
! ldb_dn_check_special(msg->dn, LTDB_ATTRIBUTES)) {
@@ -278,7 +278,8 @@ static int ltdb_add_internal(struct ldb_module *module,
const struct ldb_message *msg)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
- int ret = LDB_SUCCESS, i;
+ int ret = LDB_SUCCESS;
+ unsigned int i;
ret = ltdb_check_special_dn(module, msg);
if (ret != LDB_SUCCESS) {
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index 70b99c340c..8faefc36d0 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -93,7 +93,7 @@ int ltdb_index_del_element(struct ldb_module *module, struct ldb_dn *dn,
int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
struct ldb_message_element *el);
int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
- struct ldb_message_element *el, int v_idx);
+ struct ldb_message_element *el, unsigned int v_idx);
int ltdb_reindex(struct ldb_module *module);
int ltdb_index_transaction_start(struct ldb_module *module);
int ltdb_index_transaction_commit(struct ldb_module *module);