svn commit: samba r19132 - in branches/SAMBA_3_0/source/lib/ldb/common: .

vlendec at samba.org vlendec at samba.org
Fri Oct 6 14:39:47 GMT 2006


Author: vlendec
Date: 2006-10-06 14:39:47 +0000 (Fri, 06 Oct 2006)
New Revision: 19132

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19132

Log:
Fix some C++ warnings. Is there interest to have them in Samba4 as well?

I have some problems resolving the last 3 ones in attrib_handlers.c. In line
251 the function ldb_dn_explode_casefold is called with mem_ctx as the first
argument. Looking at ldb_dn_explode_casefold I see that the first argument it
expects is a struct ldb_context. I could certainly add a cast to (struct
ldb_context *) to that call, but I would assume that this is the wrong fix. Is
it possible that attrib_handlers.c:251 and :254 should have ldb and not
mem_ctx as the first argument?

Can anybody from Samba4 clarify this for me and apply the correct fix?

Thanks a lot.

Volker

Modified:
   branches/SAMBA_3_0/source/lib/ldb/common/ldb.c
   branches/SAMBA_3_0/source/lib/ldb/common/ldb_dn.c
   branches/SAMBA_3_0/source/lib/ldb/common/ldb_ldif.c
   branches/SAMBA_3_0/source/lib/ldb/common/ldb_modules.c
   branches/SAMBA_3_0/source/lib/ldb/common/ldb_msg.c
   branches/SAMBA_3_0/source/lib/ldb/common/ldb_parse.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -160,7 +160,7 @@
 	struct ldb_result *res;
 	struct ldb_dn *basedn=NULL;
 
-	basedn = ldb_get_opaque(ldb, "default_baseDN");
+	basedn = (struct ldb_dn *)ldb_get_opaque(ldb, "default_baseDN");
 	if (basedn) {
 		return basedn;
 	}
@@ -182,7 +182,7 @@
 
 const struct ldb_dn *ldb_get_default_basedn(struct ldb_context *ldb)
 {
-	return ldb_get_opaque(ldb, "default_baseDN");
+	return (const struct ldb_dn *)ldb_get_opaque(ldb, "default_baseDN");
 }
 
 /* 

Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb_dn.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb_dn.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -112,7 +112,7 @@
 
 	LDB_DN_NULL_FAILED(src);
 
-	dst = p = talloc_memdup(mem_ctx, src, strlen(src) + 1);
+	dst = p = (char *)talloc_memdup(mem_ctx, src, strlen(src) + 1);
 	LDB_DN_NULL_FAILED(dst);
 
 	end = &dst[strlen(dst)];
@@ -300,7 +300,8 @@
 		p[qe] = '\0';
 		p = p + qs + 1;
 		dc.value.length = strlen(p);
-		dc.value.data = talloc_memdup(mem_ctx, p, dc.value.length + 1);
+		dc.value.data = (uint8_t *)talloc_memdup(mem_ctx, p,
+							 dc.value.length + 1);
 		break;
 
 	default: /* mismatched quotes ot other error, bail out */

Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb_ldif.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb_ldif.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb_ldif.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -72,7 +72,7 @@
 		goto done;
 	}
 
-	value->data = talloc_size(mem_ctx, statbuf.st_size + 1);
+	value->data = (uint8_t *)talloc_size(mem_ctx, statbuf.st_size + 1);
 	if (value->data == NULL) {
 		ret = -1;
 		goto done;
@@ -680,7 +680,8 @@
 
 static int fgetc_file(void *private_data)
 {
-	struct ldif_read_file_state *state = private_data;
+	struct ldif_read_file_state *state =
+		(struct ldif_read_file_state *)private_data;
 	return fgetc(state->f);
 }
 
@@ -701,7 +702,8 @@
 
 static int fgetc_string(void *private_data)
 {
-	struct ldif_read_string_state *state = private_data;
+	struct ldif_read_string_state *state =
+		(struct ldif_read_string_state *)private_data;
 	if (state->s[0] != 0) {
 		return *state->s++;
 	}
@@ -730,7 +732,8 @@
 
 static int fprintf_file(void *private_data, const char *fmt, ...)
 {
-	struct ldif_write_file_state *state = private_data;
+	struct ldif_write_file_state *state =
+		(struct ldif_write_file_state *)private_data;
 	int ret;
 	va_list ap;
 

Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb_modules.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb_modules.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb_modules.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -81,7 +81,8 @@
 	int i;
 
 	/* spaces not admitted */
-	modstr = talloc_strdup_no_spaces(mem_ctx, string);
+	modstr = talloc_strdup_no_spaces((struct ldb_context *)mem_ctx,
+					 string);
 	if ( ! modstr) {
 		return NULL;
 	}

Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb_msg.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb_msg.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb_msg.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -797,7 +797,7 @@
 	if (el == NULL)
 		return 0;
 
-	val.data = discard_const(value);
+	val.data = (uint8_t *)discard_const(value);
 	val.length = strlen(value);
 
 	if (ldb_msg_find_val(el, &val))

Modified: branches/SAMBA_3_0/source/lib/ldb/common/ldb_parse.c
===================================================================
--- branches/SAMBA_3_0/source/lib/ldb/common/ldb_parse.c	2006-10-06 14:04:05 UTC (rev 19131)
+++ branches/SAMBA_3_0/source/lib/ldb/common/ldb_parse.c	2006-10-06 14:39:47 UTC (rev 19132)
@@ -67,7 +67,7 @@
 	struct ldb_val ret;
 	int slen = str?strlen(str):0;
 
-	ret.data = talloc_size(mem_ctx, slen+1);
+	ret.data = (uint8_t *)talloc_size(mem_ctx, slen+1);
 	ret.length = 0;
 	if (ret.data == NULL) return ret;
 
@@ -134,7 +134,7 @@
 char *ldb_binary_encode_string(void *mem_ctx, const char *string)
 {
 	struct ldb_val val;
-	val.data = discard_const(string);
+	val.data = (uint8_t *)discard_const(string);
 	val.length = strlen(string);
 	return ldb_binary_encode(mem_ctx, val);
 }
@@ -285,7 +285,7 @@
 	}
 
 	/* save name */
-	name = talloc_memdup(mem_ctx, t, t1 - t + 1);
+	name = (char *)talloc_memdup(mem_ctx, t, t1 - t + 1);
 	if (name == NULL) return 0;
 	name[t1 - t] = '\0';
 
@@ -326,7 +326,7 @@
 
 	while (*p && ((*p != ')') || ((*p == ')') && (*(p - 1) == '\\')))) p++;
 
-	val = talloc_memdup(mem_ctx, t, p - t + 1);
+	val = (char *)talloc_memdup(mem_ctx, t, p - t + 1);
 	if (val == NULL) {
 		talloc_free(name);
 		return 0;



More information about the samba-cvs mailing list