From a4be30c59cd6452ab595d221bc4e97bab00517a7 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Thu, 9 Aug 2012 00:01:07 +0000
Subject: Fix warnings: -Wshadow -Wpointer-arith -Wcast-align
 -Wstrict-prototypes -Wmissing-prototypes.

git-svn-id: http://svn.drobilla.net/sord/trunk@244 3d64ff67-21c5-427c-a301-fe4f08042e5a
---
 src/sord.c          | 32 ++++++++++++++++----------------
 src/sord_test.c     | 12 ++++++------
 src/sord_validate.c | 24 ++++++++++++------------
 src/sordi.c         | 10 +++++-----
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/sord.c b/src/sord.c
index c1c480f..a0f76f2 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -727,23 +727,23 @@ sord_free(SordModel* sord)
 	SordIter* i = sord_begin(sord);
 	for (; !sord_iter_end(i); sord_iter_next(i)) {
 		sord_iter_get(i, tup);
-		for (int i = 0; i < TUP_LEN; ++i) {
-			sord_drop_quad_ref(sord, (SordNode*)tup[i], (SordQuadIndex)i);
+		for (int t = 0; t < TUP_LEN; ++t) {
+			sord_drop_quad_ref(sord, (SordNode*)tup[t], (SordQuadIndex)t);
 		}
 	}
 	sord_iter_free(i);
 
 	// Free quads
-	for (ZixTreeIter* i = zix_tree_begin(sord->indices[DEFAULT_ORDER]);
-	     !zix_tree_iter_is_end(i);
-	     i = zix_tree_iter_next(i)) {
-		free(zix_tree_get(i));
+	for (ZixTreeIter* t = zix_tree_begin(sord->indices[DEFAULT_ORDER]);
+	     !zix_tree_iter_is_end(t);
+	     t = zix_tree_iter_next(t)) {
+		free(zix_tree_get(t));
 	}
 
 	// Free indices
-	for (unsigned i = 0; i < NUM_ORDERS; ++i)
-		if (sord->indices[i])
-			zix_tree_free(sord->indices[i]);
+	for (unsigned o = 0; o < NUM_ORDERS; ++o)
+		if (sord->indices[o])
+			zix_tree_free(sord->indices[o]);
 
 	free(sord);
 }
@@ -899,7 +899,7 @@ sord_lookup_name(SordWorld* world, const uint8_t* str)
 	return (SordNode*)zix_hash_find(world->names, str);
 }
 
-char*
+static char*
 sord_strndup(const char* str, size_t len)
 {
 	char* dup = (char*)malloc(len + 1);
@@ -1173,11 +1173,11 @@ sord_node_from_serd_node(SordWorld*      world,
 			SerdURI  abs_uri;
 			SerdNode abs_uri_node = serd_node_new_uri_from_node(
 				sn, &base_uri, &abs_uri);
-			SordNode* ret = sord_new_uri_counted(world,
-			                                     abs_uri_node.buf,
-			                                     abs_uri_node.n_bytes,
-			                                     abs_uri_node.n_chars,
-			                                     true);
+			ret = sord_new_uri_counted(world,
+			                           abs_uri_node.buf,
+			                           abs_uri_node.n_bytes,
+			                           abs_uri_node.n_chars,
+			                           true);
 			serd_node_free(&abs_uri_node);
 			return ret;
 		}
@@ -1194,7 +1194,7 @@ sord_node_from_serd_node(SordWorld*      world,
 		memcpy(buf,                  uri_prefix.buf, uri_prefix.len);
 		memcpy(buf + uri_prefix.len, uri_suffix.buf, uri_suffix.len);
 		buf[uri_len] = '\0';
-		SordNode* ret = sord_new_uri_counted(
+		ret = sord_new_uri_counted(
 			world, buf, uri_prefix.len + uri_suffix.len,
 			uri_prefix.len + uri_suffix.len, false);  // FIXME: UTF-8
 		return ret;
diff --git a/src/sord_test.c b/src/sord_test.c
index b871181..a7a74e5 100644
--- a/src/sord_test.c
+++ b/src/sord_test.c
@@ -38,13 +38,13 @@ uri(SordWorld* world, int num)
 	if (num == 0)
 		return 0;
 
-	char  uri[]   = "eg:000";
-	char* uri_num = uri + 3;  // First `0'
+	char  str[]   = "eg:000";
+	char* uri_num = str + 3;  // First `0'
 	snprintf(uri_num, DIGITS + 1, "%0*d", DIGITS, num);
-	return sord_new_uri(world, (const uint8_t*)uri);
+	return sord_new_uri(world, (const uint8_t*)str);
 }
 
-int
+static int
 test_fail(const char* fmt, ...)
 {
 	va_list args;
@@ -55,7 +55,7 @@ test_fail(const char* fmt, ...)
 	return 1;
 }
 
-int
+static int
 generate(SordWorld* world,
          SordModel* sord,
          size_t     n_quads,
@@ -175,7 +175,7 @@ generate(SordWorld* world,
 		((t)[1] ? sord_node_get_string((t)[1]) : USTR("*")), \
 		((t)[2] ? sord_node_get_string((t)[2]) : USTR("*"))
 
-int
+static int
 test_read(SordWorld* world, SordModel* sord, SordNode* g,
           const size_t n_quads)
 {
diff --git a/src/sord_validate.c b/src/sord_validate.c
index 8ced620..cb87878 100644
--- a/src/sord_validate.c
+++ b/src/sord_validate.c
@@ -66,8 +66,8 @@ typedef struct {
 int  n_errors        = 0;
 bool one_line_errors = false;
 
-int
-print_version()
+static int
+print_version(void)
 {
 	printf("sord_validate " SORD_VERSION
 	       " <http://drobilla.net/software/sord>\n");
@@ -78,7 +78,7 @@ print_version()
 	return 0;
 }
 
-int
+static int
 print_usage(const char* name, bool error)
 {
 	FILE* const os = error ? stderr : stdout;
@@ -94,7 +94,7 @@ print_usage(const char* name, bool error)
 	return error ? 1 : 0;
 }
 
-uint8_t*
+static uint8_t*
 absolute_path(const uint8_t* path)
 {
 #ifdef _WIN32
@@ -106,7 +106,7 @@ absolute_path(const uint8_t* path)
 #endif
 }
 
-void
+static void
 error(const char* msg, const SordQuad quad)
 {
 	const char* sep = one_line_errors ? "\t" : "\n       ";
@@ -118,7 +118,7 @@ error(const char* msg, const SordQuad quad)
 	        sep, (const char*)sord_node_get_string(quad[SORD_OBJECT]));
 }
 
-bool
+static bool
 is_subclass_of(SordModel*      model,
                const URIs*     uris,
                const SordNode* klass,
@@ -147,16 +147,16 @@ is_subclass_of(SordModel*      model,
 	return false;
 }
 
-bool
+static bool
 regexp_match(const char* pat, const char* str)
 {
 #ifdef HAVE_PCRE
-	const char* error;
+	const char* err;
 	int         erroffset;
-	pcre*       re = pcre_compile(pat, PCRE_ANCHORED, &error, &erroffset, NULL);
+	pcre*       re = pcre_compile(pat, PCRE_ANCHORED, &err, &erroffset, NULL);
 	if (!re) {
 		fprintf(stderr, "Error in regexp \"%s\" at offset %d (%s)\n",
-		        pat, erroffset, error);
+		        pat, erroffset, err);
 		return false;
 	}
 
@@ -169,7 +169,7 @@ regexp_match(const char* pat, const char* str)
 	return true;
 }
 
-bool
+static bool
 literal_is_valid(SordModel*      model,
                  const URIs*     uris,
                  const SordNode* literal,
@@ -197,7 +197,7 @@ literal_is_valid(SordModel*      model,
 	return false;
 }
 
-bool
+static bool
 check_type(SordModel*      model,
            URIs*           uris,
            const SordNode* node,
diff --git a/src/sordi.c b/src/sordi.c
index 9e4ed3a..a609194 100644
--- a/src/sordi.c
+++ b/src/sordi.c
@@ -36,8 +36,8 @@ typedef struct {
 	SordModel*  sord;
 } State;
 
-int
-print_version()
+static int
+print_version(void)
 {
 	printf("sordi " SORD_VERSION " <http://drobilla.net/software/sord>\n");
 	printf("Copyright 2011-2012 David Robillard <http://drobilla.net>.\n"
@@ -47,7 +47,7 @@ print_version()
 	return 0;
 }
 
-int
+static int
 print_usage(const char* name, bool error)
 {
 	FILE* const os = error ? stderr : stdout;
@@ -62,7 +62,7 @@ print_usage(const char* name, bool error)
 	return error ? 1 : 0;
 }
 
-bool
+static bool
 set_syntax(SerdSyntax* syntax, const char* name)
 {
 	if (!strcmp(name, "turtle")) {
@@ -76,7 +76,7 @@ set_syntax(SerdSyntax* syntax, const char* name)
 	return true;
 }
 
-uint8_t*
+static uint8_t*
 absolute_path(const uint8_t* path)
 {
 #ifdef _WIN32
-- 
cgit v1.2.1