summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-18 20:19:00 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-18 19:01:31 +0000
commit8556602b048e825b35df314d6865f997823ec2bb (patch)
treeb6a17e6047bad6a9263755f3c9fd1f7ee6df44e1
parent48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044 (diff)
downloadsamba-8556602b048e825b35df314d6865f997823ec2bb.tar.gz
samba-8556602b048e825b35df314d6865f997823ec2bb.tar.bz2
samba-8556602b048e825b35df314d6865f997823ec2bb.zip
ldb:"ldb_schema_attribute_by_name_internal" - switch back to 32bit counters
Use the signed counter for the binary search but use an unsigned one for accessing the entry. Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Mon Oct 18 19:01:31 UTC 2010 on sn-devel-104
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index 13f4d327de..ea6fafd21a 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -123,8 +123,8 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
const char *name)
{
/* for binary search we need signed variables */
- long long int i, e, b = 0;
- int r;
+ int r, i, e, b = 0;
+ unsigned int u_i;
const struct ldb_schema_attribute *def = &ldb_attribute_default;
/* as handlers are sorted, '*' must be the first if present */
@@ -139,9 +139,10 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
while (b <= e) {
i = (b + e) / 2;
- r = ldb_attr_cmp(name, ldb->schema.attributes[i].name);
+ u_i = (unsigned int) i;
+ r = ldb_attr_cmp(name, ldb->schema.attributes[u_i].name);
if (r == 0) {
- return &ldb->schema.attributes[i];
+ return &ldb->schema.attributes[u_i];
}
if (r < 0) {
e = i - 1;