From 8556602b048e825b35df314d6865f997823ec2bb Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 18 Oct 2010 20:19:00 +0200 Subject: ldb:"ldb_schema_attribute_by_name_internal" - switch back to 32bit counters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the signed counter for the binary search but use an unsigned one for accessing the entry. Autobuild-User: Matthias Dieter Wallnöfer Autobuild-Date: Mon Oct 18 19:01:31 UTC 2010 on sn-devel-104 --- source4/lib/ldb/common/ldb_attributes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/lib') 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; -- cgit