summaryrefslogtreecommitdiff
path: root/source3/lib/ldb/ldb_tdb/ldb_index.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-25 17:11:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:08 -0500
commita12fb3afdda89dd5d5eec6c9371512f668645446 (patch)
tree205bf83482a6fa7e65892a8e7a78acb6f836ce70 /source3/lib/ldb/ldb_tdb/ldb_index.c
parentca3300cbd14d93f7bb9b43e813a2bc4f9f9cc7d3 (diff)
downloadsamba-a12fb3afdda89dd5d5eec6c9371512f668645446.tar.gz
samba-a12fb3afdda89dd5d5eec6c9371512f668645446.tar.bz2
samba-a12fb3afdda89dd5d5eec6c9371512f668645446.zip
r19899: Fix some C++ warnings and klokwork ID 3147
(This used to be commit c5e041661ec6dd63188ad0a09a228192b6dfd2b3)
Diffstat (limited to 'source3/lib/ldb/ldb_tdb/ldb_index.c')
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_index.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/lib/ldb/ldb_tdb/ldb_index.c b/source3/lib/ldb/ldb_tdb/ldb_index.c
index 0c9d1f33a1..2a862c02d6 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_index.c
@@ -47,7 +47,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 = base;
+ const char *base_p = (const char *)base;
size_t min_i, max_i, test_i;
if (nmemb == 0) {
@@ -897,7 +897,8 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn,
static int ltdb_index_add0(struct ldb_module *module, const char *dn,
struct ldb_message_element *elements, int num_el)
{
- struct ltdb_private *ltdb = module->private_data;
+ struct ltdb_private *ltdb =
+ (struct ltdb_private *)module->private_data;
int ret;
unsigned int i, j;
@@ -933,7 +934,8 @@ static int ltdb_index_add0(struct ldb_module *module, const char *dn,
*/
int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg)
{
- struct ltdb_private *ltdb = module->private_data;
+ struct ltdb_private *ltdb =
+ (struct ltdb_private *)module->private_data;
char *dn;
int ret;
@@ -1025,7 +1027,8 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn,
*/
int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg)
{
- struct ltdb_private *ltdb = module->private_data;
+ struct ltdb_private *ltdb =
+ (struct ltdb_private *)module->private_data;
int ret;
char *dn;
unsigned int i, j;
@@ -1082,7 +1085,7 @@ static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, vo
*/
static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state)
{
- struct ldb_module *module = state;
+ struct ldb_module *module = (struct ldb_module *)state;
struct ldb_message *msg;
char *dn = NULL;
int ret;
@@ -1123,7 +1126,10 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
if (msg->dn == NULL) {
dn = (char *)key.dptr + 3;
} else {
- dn = ldb_dn_linearize(msg->dn, msg->dn);
+ if (!(dn = ldb_dn_linearize(msg->dn, msg->dn))) {
+ talloc_free(msg);
+ return -1;
+ }
}
ret = ltdb_index_add0(module, dn, msg->elements, msg->num_elements);
@@ -1138,7 +1144,8 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
*/
int ltdb_reindex(struct ldb_module *module)
{
- struct ltdb_private *ltdb = module->private_data;
+ struct ltdb_private *ltdb =
+ (struct ltdb_private *)module->private_data;
int ret;
if (ltdb_cache_reload(module) != 0) {