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-08 12:52:24 +0100 |
commit | 4e16a285c7c34732ba95fb5ec201e6f11cf88bef (patch) | |
tree | 9fcc4fc18c0c6a36728a511eacd34535bbec8178 /source4/lib/ldb/common/ldb_msg.c | |
parent | 30ff229a3e32549073424b423302e976c988d563 (diff) | |
download | samba-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/ldb/common/ldb_msg.c')
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 20 |
1 files changed, 11 insertions, 9 deletions
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; |