From 6aba3516769b944e7960d27f10799bb8a8898d2d Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra@samba.org>
Date: Mon, 20 Oct 2008 16:34:56 -0700
Subject: Fix warnings. Jeremy.

---
 source3/lib/netapi/tests/netfile.c       | 22 ++++++++++++----------
 source3/lib/netapi/tests/netgroup.c      | 10 +++++-----
 source3/lib/netapi/tests/netlocalgroup.c |  6 +++---
 source3/lib/netapi/tests/netshare.c      |  8 ++++----
 source3/lib/netapi/tests/netuser.c       | 20 ++++++++++----------
 5 files changed, 34 insertions(+), 32 deletions(-)

(limited to 'source3/lib/netapi/tests')

diff --git a/source3/lib/netapi/tests/netfile.c b/source3/lib/netapi/tests/netfile.c
index 36ee8288ee..bee3c2ed5e 100644
--- a/source3/lib/netapi/tests/netfile.c
+++ b/source3/lib/netapi/tests/netfile.c
@@ -37,8 +37,8 @@ static NET_API_STATUS test_netfileenum(const char *hostname,
 	uint8_t *buffer = NULL;
 	int i;
 
-	struct FILE_INFO_2 *i2;
-	struct FILE_INFO_3 *i3;
+	struct FILE_INFO_2 *i2 = NULL;
+	struct FILE_INFO_3 *i3 = NULL;
 
 	printf("testing NetFileEnum level %d\n", level);
 
@@ -98,8 +98,6 @@ NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx,
 			       const char *hostname)
 {
 	NET_API_STATUS status = 0;
-	uint8_t *buffer = NULL;
-	uint32_t levels[] = { 2, 3 };
 	uint32_t enum_levels[] = { 2, 3 };
 	int i;
 
@@ -118,14 +116,18 @@ NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx,
 
 	/* basic queries */
 #if 0
-	for (i=0; i<ARRAY_SIZE(levels); i++) {
+	{
+		uint32_t levels[] = { 2, 3 };
+		for (i=0; i<ARRAY_SIZE(levels); i++) {
+			uint8_t *buffer = NULL;
 
-		printf("testing NetFileGetInfo level %d\n", levels[i]);
+			printf("testing NetFileGetInfo level %d\n", levels[i]);
 
-		status = NetFileGetInfo(hostname, fid, levels[i], &buffer);
-		if (status && status != 124) {
-			NETAPI_STATUS(ctx, status, "NetFileGetInfo");
-			goto out;
+			status = NetFileGetInfo(hostname, fid, levels[i], &buffer);
+			if (status && status != 124) {
+				NETAPI_STATUS(ctx, status, "NetFileGetInfo");
+				goto out;
+			}
 		}
 	}
 #endif
diff --git a/source3/lib/netapi/tests/netgroup.c b/source3/lib/netapi/tests/netgroup.c
index a89a772ce4..51a21b3bf5 100644
--- a/source3/lib/netapi/tests/netgroup.c
+++ b/source3/lib/netapi/tests/netgroup.c
@@ -36,14 +36,14 @@ static NET_API_STATUS test_netgroupenum(const char *hostname,
 	uint32_t total_entries = 0;
 	uint32_t resume_handle = 0;
 	int found_group = 0;
-	const char *current_name;
+	const char *current_name = NULL;
 	uint8_t *buffer = NULL;
 	int i;
 
-	struct GROUP_INFO_0 *info0;
-	struct GROUP_INFO_1 *info1;
-	struct GROUP_INFO_2 *info2;
-	struct GROUP_INFO_3 *info3;
+	struct GROUP_INFO_0 *info0 = NULL;
+	struct GROUP_INFO_1 *info1 = NULL;
+	struct GROUP_INFO_2 *info2 = NULL;
+	struct GROUP_INFO_3 *info3 = NULL;
 
 	printf("testing NetGroupEnum level %d\n", level);
 
diff --git a/source3/lib/netapi/tests/netlocalgroup.c b/source3/lib/netapi/tests/netlocalgroup.c
index 0d82059356..76c59c814b 100644
--- a/source3/lib/netapi/tests/netlocalgroup.c
+++ b/source3/lib/netapi/tests/netlocalgroup.c
@@ -36,12 +36,12 @@ static NET_API_STATUS test_netlocalgroupenum(const char *hostname,
 	uint32_t total_entries = 0;
 	uint32_t resume_handle = 0;
 	int found_group = 0;
-	const char *current_name;
+	const char *current_name = NULL;
 	uint8_t *buffer = NULL;
 	int i;
 
-	struct LOCALGROUP_INFO_0 *info0;
-	struct LOCALGROUP_INFO_1 *info1;
+	struct LOCALGROUP_INFO_0 *info0 = NULL;
+	struct LOCALGROUP_INFO_1 *info1 = NULL;
 
 	printf("testing NetLocalGroupEnum level %d\n", level);
 
diff --git a/source3/lib/netapi/tests/netshare.c b/source3/lib/netapi/tests/netshare.c
index 9446c307b3..84af9e0827 100644
--- a/source3/lib/netapi/tests/netshare.c
+++ b/source3/lib/netapi/tests/netshare.c
@@ -36,13 +36,13 @@ static NET_API_STATUS test_netshareenum(const char *hostname,
 	uint32_t total_entries = 0;
 	uint32_t resume_handle = 0;
 	int found_share = 0;
-	const char *current_name;
+	const char *current_name = NULL;
 	uint8_t *buffer = NULL;
 	int i;
 
-	struct SHARE_INFO_0 *i0;
-	struct SHARE_INFO_1 *i1;
-	struct SHARE_INFO_2 *i2;
+	struct SHARE_INFO_0 *i0 = NULL;
+	struct SHARE_INFO_1 *i1 = NULL;
+	struct SHARE_INFO_2 *i2 = NULL;
 
 	printf("testing NetShareEnum level %d\n", level);
 
diff --git a/source3/lib/netapi/tests/netuser.c b/source3/lib/netapi/tests/netuser.c
index f1622e45c4..7bbc5ca347 100644
--- a/source3/lib/netapi/tests/netuser.c
+++ b/source3/lib/netapi/tests/netuser.c
@@ -35,20 +35,20 @@ static NET_API_STATUS test_netuserenum(const char *hostname,
 	uint32_t entries_read = 0;
 	uint32_t total_entries = 0;
 	uint32_t resume_handle = 0;
-	const char *current_name;
+	const char *current_name = NULL;
 	int found_user = 0;
 	uint8_t *buffer = NULL;
 	int i;
 
-	struct USER_INFO_0 *info0;
-	struct USER_INFO_1 *info1;
-	struct USER_INFO_2 *info2;
-	struct USER_INFO_3 *info3;
-	struct USER_INFO_4 *info4;
-	struct USER_INFO_10 *info10;
-	struct USER_INFO_11 *info11;
-	struct USER_INFO_20 *info20;
-	struct USER_INFO_23 *info23;
+	struct USER_INFO_0 *info0 = NULL;
+	struct USER_INFO_1 *info1 = NULL;
+	struct USER_INFO_2 *info2 = NULL;
+	struct USER_INFO_3 *info3 = NULL;
+	struct USER_INFO_4 *info4 = NULL;
+	struct USER_INFO_10 *info10 = NULL;
+	struct USER_INFO_11 *info11 = NULL;
+	struct USER_INFO_20 *info20 = NULL;
+	struct USER_INFO_23 *info23 = NULL;
 
 	printf("testing NetUserEnum level %d\n", level);
 
-- 
cgit