summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-09-01 12:01:03 +1000
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-10-02 12:45:02 +0200
commitf0c2c9854c7659221fe9480110a7d9b2b48afbf9 (patch)
treec7a6513ad953b407d7c778d7985df784e5755c00 /source4/lib/ldb/ldb_tdb
parent38f87f40bfd7892043d49009067ae28431279580 (diff)
downloadsamba-f0c2c9854c7659221fe9480110a7d9b2b48afbf9.tar.gz
samba-f0c2c9854c7659221fe9480110a7d9b2b48afbf9.tar.bz2
samba-f0c2c9854c7659221fe9480110a7d9b2b48afbf9.zip
s4:ldb Fix ldb_list_find() folowing the change from char * to TDB_DATA
(The format of index records in the internal manipulation changed) Andrew Bartlett
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index b959471d16..7b8d2c249b 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -369,7 +369,7 @@ static int ldb_list_find(const void *needle,
const void *base, size_t nmemb, size_t size,
comparison_fn_t comp_fn)
{
- const char *base_p = (const char *)base;
+ const uint8_t *base_p = (const uint8_t *)base;
size_t min_i, max_i, test_i;
if (nmemb == 0) {
@@ -383,17 +383,11 @@ static int ldb_list_find(const void *needle,
int r;
test_i = (min_i + max_i) / 2;
- /* the following cast looks strange, but is
- correct. The key to understanding it is that base_p
- is a pointer to an array of pointers, so we have to
- dereference it after casting to void **. The strange
- const in the middle gives us the right type of pointer
- after the dereference (tridge) */
- r = comp_fn(needle, *(void * const *)(base_p + (size * test_i)));
+ r = comp_fn(needle, (void const *)(base_p + (size * test_i)));
if (r == 0) {
/* scan back for first element */
while (test_i > 0 &&
- comp_fn(needle, *(void * const *)(base_p + (size * (test_i-1)))) == 0) {
+ comp_fn(needle, (void const *)(base_p + (size * (test_i-1)))) == 0) {
test_i--;
}
return test_i;
@@ -409,7 +403,7 @@ static int ldb_list_find(const void *needle,
}
}
- if (comp_fn(needle, *(void * const *)(base_p + (size * min_i))) == 0) {
+ if (comp_fn(needle, (void const *)(base_p + (size * min_i))) == 0) {
return min_i;
}