summaryrefslogtreecommitdiff
path: root/source4/lib
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 12:52:24 +0100
commit4e16a285c7c34732ba95fb5ec201e6f11cf88bef (patch)
tree9fcc4fc18c0c6a36728a511eacd34535bbec8178 /source4/lib
parent30ff229a3e32549073424b423302e976c988d563 (diff)
downloadsamba-4e16a285c7c34732ba95fb5ec201e6f11cf88bef.tar.gz
samba-4e16a285c7c34732ba95fb5ec201e6f11cf88bef.tar.bz2
samba-4e16a285c7c34732ba95fb5ec201e6f11cf88bef.zip
LDB:common - Change counters to "unsigned" where appropriate
To count LDB objects use variables of type "unsigned (int)" or "long long int" on binary or downto searches. To count characters in strings use "size_t". To calculate differences between pointers use "ptrdiff_t".
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c4
-rw-r--r--source4/lib/ldb/common/ldb.c4
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c15
-rw-r--r--source4/lib/ldb/common/ldb_controls.c14
-rw-r--r--source4/lib/ldb/common/ldb_dn.c46
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c2
-rw-r--r--source4/lib/ldb/common/ldb_match.c4
-rw-r--r--source4/lib/ldb/common/ldb_modules.c12
-rw-r--r--source4/lib/ldb/common/ldb_msg.c20
-rw-r--r--source4/lib/ldb/common/ldb_parse.c16
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c6
11 files changed, 76 insertions, 67 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 464707530e..2a2bd0852e 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -55,7 +55,7 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out)
{
char *s, *t;
- int l;
+ size_t l;
if (!in || !out || !(in->data)) {
return -1;
@@ -456,7 +456,7 @@ static const struct ldb_schema_syntax ldb_standard_syntaxes[] = {
const struct ldb_schema_syntax *ldb_standard_syntax_by_name(struct ldb_context *ldb,
const char *syntax)
{
- int i;
+ unsigned int i;
unsigned num_handlers = sizeof(ldb_standard_syntaxes)/sizeof(ldb_standard_syntaxes[0]);
/* TODO: should be replaced with a binary search */
for (i=0;i<num_handlers;i++) {
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 94fd6cde1e..bbb3b79e6c 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -665,7 +665,7 @@ int ldb_request_get_status(struct ldb_request *req)
static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req)
{
TALLOC_CTX *tmp_ctx = talloc_new(req);
- int i;
+ unsigned int i;
switch (req->operation) {
case LDB_SEARCH:
@@ -845,7 +845,7 @@ int ldb_search_default_callback(struct ldb_request *req,
struct ldb_reply *ares)
{
struct ldb_result *res;
- int n;
+ unsigned int n;
res = talloc_get_type(req->context, struct ldb_result);
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index 79c5dd69de..13f4d327de 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -49,7 +49,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
unsigned flags,
const struct ldb_schema_syntax *syntax)
{
- int i, n;
+ unsigned int i, n;
struct ldb_schema_attribute *a;
if (!syntax) {
@@ -122,7 +122,9 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
struct ldb_context *ldb,
const char *name)
{
- int i, e, b = 0, r;
+ /* for binary search we need signed variables */
+ long long int i, e, b = 0;
+ int r;
const struct ldb_schema_attribute *def = &ldb_attribute_default;
/* as handlers are sorted, '*' must be the first if present */
@@ -135,7 +137,6 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
e = ldb->schema.num_attributes - 1;
while (b <= e) {
-
i = (b + e) / 2;
r = ldb_attr_cmp(name, ldb->schema.attributes[i].name);
@@ -179,7 +180,7 @@ const struct ldb_schema_attribute *ldb_schema_attribute_by_name(struct ldb_conte
void ldb_schema_attribute_remove(struct ldb_context *ldb, const char *name)
{
const struct ldb_schema_attribute *a;
- int i;
+ ptrdiff_t i;
a = ldb_schema_attribute_by_name_internal(ldb, name);
if (a == NULL || a->name == NULL) {
@@ -232,7 +233,7 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb)
{ "ou", LDB_SYNTAX_DIRECTORY_STRING },
{ "objectClass", LDB_SYNTAX_OBJECTCLASS }
};
- int i;
+ unsigned int i;
int ret;
for (i=0;i<ARRAY_SIZE(wellknown);i++) {
@@ -254,7 +255,7 @@ int ldb_dn_extended_add_syntax(struct ldb_context *ldb,
unsigned flags,
const struct ldb_dn_extended_syntax *syntax)
{
- int n;
+ unsigned int n;
struct ldb_dn_extended_syntax *a;
if (!syntax) {
@@ -284,7 +285,7 @@ int ldb_dn_extended_add_syntax(struct ldb_context *ldb,
const struct ldb_dn_extended_syntax *ldb_dn_extended_syntax_by_name(struct ldb_context *ldb,
const char *name)
{
- int i;
+ unsigned int i;
for (i=0; i < ldb->schema.num_dn_extended_syntax; i++) {
if (ldb_attr_cmp(ldb->schema.dn_extended_syntax[i].name, name) == 0) {
return &ldb->schema.dn_extended_syntax[i];
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index 8da43ab9b1..ef0e06f6ce 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -37,7 +37,7 @@
/* returns NULL if not found */
struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char *oid)
{
- int i;
+ unsigned int i;
if (req->controls != NULL) {
for (i = 0; req->controls[i]; i++) {
@@ -56,7 +56,7 @@ struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char
/* returns NULL if not found */
struct ldb_control *ldb_reply_get_control(struct ldb_reply *rep, const char *oid)
{
- int i;
+ unsigned int i;
if (rep->controls != NULL) {
for (i = 0; rep->controls[i]; i++) {
@@ -77,7 +77,7 @@ the "exclude" control */
int save_controls(struct ldb_control *exclude, struct ldb_request *req, struct ldb_control ***saver)
{
struct ldb_control **lcs;
- int i, j;
+ unsigned int i, j;
*saver = req->controls;
for (i = 0; req->controls[i]; i++);
@@ -110,7 +110,7 @@ struct ldb_control **controls_except_specified(struct ldb_control **controls_in,
struct ldb_control *exclude)
{
struct ldb_control **lcs = NULL;
- int i, j;
+ unsigned int i, j;
for (i = 0; controls_in && controls_in[i]; i++);
@@ -147,7 +147,7 @@ struct ldb_control **controls_except_specified(struct ldb_control **controls_in,
/* return True if any, False if none */
int check_critical_controls(struct ldb_control **controls)
{
- int i;
+ unsigned int i;
if (controls == NULL) {
return 0;
@@ -164,7 +164,7 @@ int check_critical_controls(struct ldb_control **controls)
int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data)
{
- unsigned i, n;
+ unsigned int i, n;
struct ldb_control **ctrls;
struct ldb_control *ctrl;
@@ -238,7 +238,7 @@ int ldb_reply_add_control(struct ldb_reply *ares, const char *oid, bool critical
struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *mem_ctx, const char **control_strings)
{
- int i;
+ unsigned int i;
struct ldb_control **ctrl;
char *error_string = NULL;
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index eb7d1220db..d91e9d9fa9 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -191,7 +191,7 @@ static int ldb_dn_escape_internal(char *dst, const char *src, int len)
{
const char *p, *s;
char *d;
- int l;
+ size_t l;
p = s = src;
d = dst;
@@ -297,8 +297,9 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
bool in_quote = false;
bool is_oid = false;
bool escape = false;
- unsigned x;
- int l, ret;
+ unsigned int x;
+ size_t l;
+ int ret;
char *parse_dn;
bool is_index;
@@ -740,7 +741,8 @@ bool ldb_dn_validate(struct ldb_dn *dn)
const char *ldb_dn_get_linearized(struct ldb_dn *dn)
{
- int i, len;
+ unsigned int i;
+ size_t len;
char *d, *n;
if ( ! dn || ( dn->invalid)) return NULL;
@@ -806,7 +808,7 @@ char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode)
{
const char *linearized = ldb_dn_get_linearized(dn);
char *p = NULL;
- int i;
+ unsigned int i;
if (!linearized) {
return NULL;
@@ -884,7 +886,7 @@ char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode)
*/
void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept)
{
- int i;
+ unsigned int i;
for (i=0; i<dn->ext_comp_num; i++) {
if (!ldb_attr_in_list(accept, dn->ext_components[i].name)) {
memmove(&dn->ext_components[i],
@@ -910,7 +912,8 @@ char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn)
static bool ldb_dn_casefold_internal(struct ldb_dn *dn)
{
- int i, ret;
+ unsigned int i;
+ int ret;
if ( ! dn || dn->invalid) return false;
@@ -955,7 +958,8 @@ failed:
const char *ldb_dn_get_casefold(struct ldb_dn *dn)
{
- int i, len;
+ unsigned int i;
+ size_t len;
char *d, *n;
if (dn->casefold) return dn->casefold;
@@ -1025,7 +1029,7 @@ char *ldb_dn_alloc_casefold(void *mem_ctx, struct ldb_dn *dn)
int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn)
{
int ret;
- int n_base, n_dn;
+ long long int n_base, n_dn;
if ( ! base || base->invalid) return 1;
if ( ! dn || dn->invalid) return -1;
@@ -1111,7 +1115,8 @@ int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn)
int ldb_dn_compare(struct ldb_dn *dn0, struct ldb_dn *dn1)
{
- int i, ret;
+ unsigned int i;
+ int ret;
if (( ! dn0) || dn0->invalid || ! dn1 || dn1->invalid) {
return -1;
@@ -1269,7 +1274,7 @@ struct ldb_dn *ldb_dn_copy(void *mem_ctx, struct ldb_dn *dn)
*new_dn = *dn;
if (dn->components) {
- int i;
+ unsigned int i;
new_dn->components =
talloc_zero_array(new_dn,
@@ -1292,7 +1297,7 @@ struct ldb_dn *ldb_dn_copy(void *mem_ctx, struct ldb_dn *dn)
}
if (dn->ext_components) {
- int i;
+ unsigned int i;
new_dn->ext_components =
talloc_zero_array(new_dn,
@@ -1358,7 +1363,7 @@ bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base)
}
if (dn->components) {
- int i;
+ unsigned int i;
if ( ! ldb_dn_validate(base)) {
return false;
@@ -1480,7 +1485,8 @@ bool ldb_dn_add_child(struct ldb_dn *dn, struct ldb_dn *child)
}
if (dn->components) {
- int n, i, j;
+ unsigned int n;
+ long long int i, j;
if ( ! ldb_dn_validate(child)) {
return false;
@@ -1588,7 +1594,7 @@ bool ldb_dn_add_child_fmt(struct ldb_dn *dn, const char *child_fmt, ...)
bool ldb_dn_remove_base_components(struct ldb_dn *dn, unsigned int num)
{
- int i;
+ long long int i;
if ( ! ldb_dn_validate(dn)) {
return false;
@@ -1631,7 +1637,7 @@ bool ldb_dn_remove_base_components(struct ldb_dn *dn, unsigned int num)
bool ldb_dn_remove_child_components(struct ldb_dn *dn, unsigned int num)
{
- int i, j;
+ unsigned int i, j;
if ( ! ldb_dn_validate(dn)) {
return false;
@@ -1706,7 +1712,7 @@ struct ldb_dn *ldb_dn_get_parent(void *mem_ctx, struct ldb_dn *dn)
*/
static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
- int i;
+ long long int i;
TALLOC_CTX *tmpctx;
char *cracked = NULL;
const char *format = (ex_format ? "\n" : "/" );
@@ -1851,7 +1857,7 @@ int ldb_dn_set_component(struct ldb_dn *dn, int num,
dn->components[num].value = v;
if (dn->valid_case) {
- int i;
+ unsigned int i;
for (i = 0; i < dn->comp_num; i++) {
LDB_FREE(dn->components[i].cf_name);
LDB_FREE(dn->components[i].cf_value.data);
@@ -1873,7 +1879,7 @@ int ldb_dn_set_component(struct ldb_dn *dn, int num,
const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn,
const char *name)
{
- int i;
+ unsigned int i;
if ( ! ldb_dn_validate(dn)) {
return NULL;
}
@@ -1889,7 +1895,7 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn,
const char *name, const struct ldb_val *val)
{
struct ldb_dn_ext_component *p;
- int i;
+ unsigned int i;
struct ldb_val v2;
if ( ! ldb_dn_validate(dn)) {
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 819caa79d3..8e1e165ada 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -219,7 +219,7 @@ int ldb_should_b64_encode(struct ldb_context *ldb, const struct ldb_val *val)
static int fold_string(int (*fprintf_fn)(void *, const char *, ...), void *private_data,
const char *buf, size_t length, int start_pos)
{
- unsigned int i;
+ size_t i;
int total=0, ret;
for (i=0;i<length;i++) {
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c
index 4bd121a438..74bc015d5a 100644
--- a/source4/lib/ldb/common/ldb_match.c
+++ b/source4/lib/ldb/common/ldb_match.c
@@ -189,7 +189,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb,
struct ldb_val *chunk;
char *p, *g;
uint8_t *save_p = NULL;
- int c = 0;
+ unsigned int c = 0;
a = ldb_schema_attribute_by_name(ldb, tree->u.substring.attr);
@@ -304,7 +304,7 @@ static int ldb_match_extended(struct ldb_context *ldb,
const struct ldb_parse_tree *tree,
enum ldb_scope scope)
{
- int i;
+ unsigned int i;
const struct {
const char *oid;
int (*comparator)(const struct ldb_val *, const struct ldb_val *);
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 4cf5dc87d1..ce6031f600 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -48,7 +48,7 @@ void ldb_set_modules_dir(struct ldb_context *ldb, const char *path)
static char *ldb_modules_strdup_no_spaces(TALLOC_CTX *mem_ctx, const char *string)
{
- int i, len;
+ size_t i, len;
char *trimmed;
trimmed = talloc_strdup(mem_ctx, string);
@@ -79,7 +79,7 @@ const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *m
char **modules = NULL;
const char **m;
char *modstr, *p;
- int i;
+ unsigned int i;
/* spaces not admitted */
modstr = ldb_modules_strdup_no_spaces(mem_ctx, string);
@@ -144,7 +144,7 @@ static const struct ldb_builtins {
static ldb_connect_fn ldb_find_backend(const char *url)
{
struct backends_list_entry *backend;
- int i;
+ unsigned int i;
for (i = 0; builtins[i].backend_ops || builtins[i].module_ops; i++) {
if (builtins[i].backend_ops == NULL) continue;
@@ -262,7 +262,7 @@ int ldb_connect_backend(struct ldb_context *ldb,
static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
{
struct ops_list_entry *e;
- int i;
+ unsigned int i;
for (i = 0; builtins[i].backend_ops || builtins[i].module_ops; i++) {
if (builtins[i].module_ops == NULL) continue;
@@ -333,7 +333,7 @@ static void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out)
{
struct ldb_module *module;
- int i;
+ unsigned int i;
module = backend;
@@ -399,7 +399,7 @@ int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module)
int ldb_load_modules(struct ldb_context *ldb, const char *options[])
{
const char **modules = NULL;
- int i;
+ unsigned int i;
int ret;
TALLOC_CTX *mem_ctx = talloc_new(ldb);
if (!mem_ctx) {
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 3c5b64e7b3..2d2b34dd33 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -476,7 +476,7 @@ struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg)
{
struct ldb_message *msg2;
- int i;
+ unsigned int i;
msg2 = talloc(mem_ctx, struct ldb_message);
if (msg2 == NULL) return NULL;
@@ -506,7 +506,7 @@ struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg)
{
struct ldb_message *msg2;
- int i, j;
+ unsigned int i, j;
msg2 = ldb_msg_copy_shallow(mem_ctx, msg);
if (msg2 == NULL) return NULL;
@@ -542,7 +542,7 @@ failed:
struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb,
const struct ldb_message *msg)
{
- int i;
+ unsigned int i;
struct ldb_message *msg2;
msg2 = ldb_msg_copy(ldb, msg);
@@ -640,7 +640,7 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb,
int ldb_msg_sanity_check(struct ldb_context *ldb,
const struct ldb_message *msg)
{
- int i, j;
+ unsigned int i, j;
/* basic check on DN */
if (msg->dn == NULL) {
@@ -678,7 +678,8 @@ int ldb_msg_sanity_check(struct ldb_context *ldb,
const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs)
{
const char **ret;
- int i;
+ unsigned int i;
+
for (i=0;attrs && attrs[i];i++) /* noop */ ;
ret = talloc_array(mem_ctx, const char *, i+1);
if (ret == NULL) {
@@ -699,8 +700,9 @@ const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs)
const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *attrs, const char *new_attr)
{
const char **ret;
- int i;
+ unsigned int i;
bool found = false;
+
for (i=0;attrs && attrs[i];i++) {
if (ldb_attr_cmp(attrs[i], new_attr) == 0) {
found = true;
@@ -727,7 +729,7 @@ const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *att
*/
int ldb_attr_in_list(const char * const *attrs, const char *attr)
{
- int i;
+ unsigned int i;
for (i=0;attrs && attrs[i];i++) {
if (ldb_attr_cmp(attrs[i], attr) == 0) {
return 1;
@@ -774,7 +776,7 @@ int ldb_msg_copy_attr(struct ldb_message *msg, const char *attr, const char *rep
*/
void ldb_msg_remove_element(struct ldb_message *msg, struct ldb_message_element *el)
{
- int n = (el - msg->elements);
+ ptrdiff_t n = (el - msg->elements);
if (n >= msg->num_elements) {
/* should we abort() here? */
return;
@@ -936,7 +938,7 @@ time_t ldb_string_utc_to_time(const char *s)
*/
void ldb_dump_results(struct ldb_context *ldb, struct ldb_result *result, FILE *f)
{
- int i;
+ unsigned int i;
for (i = 0; i < result->count; i++) {
struct ldb_ldif ldif;
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index 75cc6e74d0..a5aa28bb5a 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -61,9 +61,9 @@ a filter is defined by:
*/
struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str)
{
- int i, j;
+ size_t i, j;
struct ldb_val ret;
- int slen = str?strlen(str):0;
+ size_t slen = str?strlen(str):0;
ret.data = (uint8_t *)talloc_size(mem_ctx, slen+1);
ret.length = 0;
@@ -96,9 +96,9 @@ struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str)
*/
char *ldb_binary_encode(void *mem_ctx, struct ldb_val val)
{
- int i;
+ size_t i;
char *ret;
- int len = val.length;
+ size_t len = val.length;
unsigned char *buf = val.data;
for (i=0;i<val.length;i++) {
@@ -162,7 +162,7 @@ static char *ldb_parse_find_wildcard(char *value)
static struct ldb_val **ldb_wildcard_decode(void *mem_ctx, const char *string)
{
struct ldb_val **ret = NULL;
- int val = 0;
+ unsigned int val = 0;
char *wc, *str;
wc = talloc_strdup(mem_ctx, string);
@@ -657,7 +657,7 @@ struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s)
char *ldb_filter_from_tree(void *mem_ctx, struct ldb_parse_tree *tree)
{
char *s, *s2, *ret;
- int i;
+ unsigned int i;
if (tree == NULL) {
return NULL;
@@ -780,7 +780,7 @@ void ldb_parse_tree_attr_replace(struct ldb_parse_tree *tree,
const char *attr,
const char *replace)
{
- int i;
+ unsigned int i;
switch (tree->operation) {
case LDB_OP_AND:
case LDB_OP_OR:
@@ -826,7 +826,7 @@ void ldb_parse_tree_attr_replace(struct ldb_parse_tree *tree,
struct ldb_parse_tree *ldb_parse_tree_copy_shallow(TALLOC_CTX *mem_ctx,
const struct ldb_parse_tree *ot)
{
- int i;
+ unsigned int i;
struct ldb_parse_tree *nt;
nt = talloc(mem_ctx, struct ldb_parse_tree);
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index 0a8a89ac1d..73ae71bb9c 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -55,7 +55,7 @@ void ldb_set_utf8_fns(struct ldb_context *ldb,
*/
char *ldb_casefold_default(void *context, void *mem_ctx, const char *s, size_t n)
{
- int i;
+ size_t i;
char *ret = talloc_strndup(mem_ctx, s, n);
if (!s) {
errno = ENOMEM;
@@ -84,7 +84,7 @@ char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s, size_t
int ldb_valid_attr_name(const char *s)
{
- int i;
+ size_t i;
if (!s || !s[0])
return 0;
@@ -111,7 +111,7 @@ int ldb_valid_attr_name(const char *s)
char *ldb_attr_casefold(void *mem_ctx, const char *s)
{
- int i;
+ size_t i;
char *ret = talloc_strdup(mem_ctx, s);
if (!ret) {
errno = ENOMEM;