avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcrea...@apache.org
Subject svn commit: r1331812 [2/5] - in /avro/trunk: ./ lang/c/ lang/c/examples/ lang/c/jansson/src/ lang/c/src/ lang/c/src/avro/ lang/c/tests/
Date Sat, 28 Apr 2012 19:40:55 GMT
Modified: avro/trunk/lang/c/src/datum_value.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/datum_value.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/datum_value.c (original)
+++ avro/trunk/lang/c/src/datum_value.c Sat Apr 28 19:40:52 2012
@@ -15,7 +15,7 @@
  * permissions and limitations under the License.
  */
 
-#include <stdint.h>
+#include <avro/platform.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -28,7 +28,7 @@
 #include "avro/value.h"
 #include "avro_private.h"
 
-static avro_value_iface_t  AVRO_DATUM_VALUE_CLASS;
+extern avro_value_iface_t  AVRO_DATUM_VALUE_CLASS;
 
 avro_value_iface_t *
 avro_datum_class(void)
@@ -55,14 +55,14 @@ avro_datum_as_child_value(avro_value_t *
 static void
 avro_datum_value_incref(avro_value_t *value)
 {
-	avro_datum_t  self = value->self;
+	avro_datum_t  self = (avro_datum_t) value->self;
 	avro_datum_incref(self);
 }
 
 static void
 avro_datum_value_decref(avro_value_t *value)
 {
-	avro_datum_t  self = value->self;
+	avro_datum_t  self = (avro_datum_t) value->self;
 	avro_datum_decref(self);
 }
 
@@ -70,7 +70,7 @@ static int
 avro_datum_value_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_datum_reset(self);
 }
@@ -80,7 +80,19 @@ avro_datum_value_get_type(const avro_val
 {
 	AVRO_UNUSED(iface);
 	const avro_datum_t  self = (const avro_datum_t) vself;
-	check_param(EINVAL, self, "datum instance");
+#ifdef _WIN32
+#pragma message("#warning: Bug: EINVAL is not of type avro_type_t.")
+#else
+#warning "Bug: EINVAL is not of type avro_type_t."
+#endif
+        /* We shouldn't use EINVAL as the return value to
+         * check_param(), because EINVAL (= 22) is not a valid enum
+         * avro_type_t. This is a structural issue -- we would need a
+         * different interface on all the get_type functions to fix
+         * this. For now, suppressing the error by casting EINVAL to
+         * (avro_type_t) so the code compiles under C++.
+         */
+	check_param((avro_type_t) EINVAL, self, "datum instance");
 	return avro_typeof(self);
 }
 
@@ -311,7 +323,7 @@ avro_datum_value_set_boolean(const avro_
 			     void *vself, int val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_boolean_set(self, val);
 }
@@ -321,9 +333,9 @@ avro_datum_value_set_bytes(const avro_va
 			   void *vself, void *buf, size_t size)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
-	return avro_bytes_set(self, buf, size);
+	return avro_bytes_set(self, (const char *) buf, size);
 }
 
 static int
@@ -347,7 +359,7 @@ avro_datum_value_set_double(const avro_v
 			    void *vself, double val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_double_set(self, val);
 }
@@ -357,7 +369,7 @@ avro_datum_value_set_float(const avro_va
 			   void *vself, float val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_float_set(self, val);
 }
@@ -367,7 +379,7 @@ avro_datum_value_set_int(const avro_valu
 			 void *vself, int32_t val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_int32_set(self, val);
 }
@@ -377,7 +389,7 @@ avro_datum_value_set_long(const avro_val
 			  void *vself, int64_t val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_int64_set(self, val);
 }
@@ -386,7 +398,7 @@ static int
 avro_datum_value_set_null(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, is_avro_null(self), "datum instance");
 	return 0;
 }
@@ -396,7 +408,7 @@ avro_datum_value_set_string(const avro_v
 			    void *vself, const char *str)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_string_set(self, str);
 }
@@ -407,7 +419,7 @@ avro_datum_value_set_string_len(const av
 {
 	AVRO_UNUSED(iface);
 	AVRO_UNUSED(size);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_string_set(self, str);
 }
@@ -433,7 +445,7 @@ avro_datum_value_set_enum(const avro_val
 			  void *vself, int val)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 	return avro_enum_set(self, val);
 }
@@ -443,9 +455,9 @@ avro_datum_value_set_fixed(const avro_va
 			   void *vself, void *buf, size_t size)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
-	return avro_fixed_set(self, buf, size);
+	return avro_fixed_set(self, (const char *) buf, size);
 }
 
 static int
@@ -615,7 +627,7 @@ avro_datum_value_append(const avro_value
 			void *vself, avro_value_t *child_out, size_t *new_index)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 
 	if (!is_avro_array(self)) {
@@ -650,7 +662,7 @@ avro_datum_value_add(const avro_value_if
 		     avro_value_t *child, size_t *index, int *is_new)
 {
 	AVRO_UNUSED(iface);
-	avro_datum_t  self = vself;
+	avro_datum_t  self = (avro_datum_t) vself;
 	check_param(EINVAL, self, "datum instance");
 
 	if (!is_avro_map(self)) {
@@ -719,7 +731,7 @@ avro_datum_value_set_branch(const avro_v
 }
 
 
-static avro_value_iface_t  AVRO_DATUM_VALUE_CLASS =
+avro_value_iface_t  AVRO_DATUM_VALUE_CLASS =
 {
 	/* "class" methods */
 	NULL, /* incref */

Modified: avro/trunk/lang/c/src/dump.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/dump.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/dump.c (original)
+++ avro/trunk/lang/c/src/dump.c Sat Apr 28 19:40:52 2012
@@ -16,12 +16,11 @@
  */
 
 #include <ctype.h>
-#include <stdint.h>
 #include <string.h>
 #include "avro_private.h"
 #include "dump.h"
 
-static void dump_line(FILE * out, const caddr_t addr, const long len)
+static void dump_line(FILE * out, const char *addr, const long len)
 {
 	int i;
 	fprintf(out, "|");
@@ -46,7 +45,7 @@ static void dump_line(FILE * out, const 
 	}
 }
 
-void dump(FILE * out, const caddr_t addr, const long len)
+void dump(FILE * out, const char *addr, const long len)
 {
 	int i;
 	for (i = 0; i < len; i += 16) {

Modified: avro/trunk/lang/c/src/dump.h
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/dump.h?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/dump.h (original)
+++ avro/trunk/lang/c/src/dump.h Sat Apr 28 19:40:52 2012
@@ -17,10 +17,16 @@
 
 #ifndef DUMP_H
 #define DUMP_H
+#ifdef __cplusplus
+extern "C" {
+#define CLOSE_EXTERN }
+#else
+#define CLOSE_EXTERN
+#endif
 
 #include <stdio.h>
-#include <sys/types.h>
 
-void dump(FILE * out, const caddr_t addr, const long len);
+void dump(FILE * out, const char *addr, const long len);
 
+CLOSE_EXTERN
 #endif

Modified: avro/trunk/lang/c/src/encoding.h
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/encoding.h?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/encoding.h (original)
+++ avro/trunk/lang/c/src/encoding.h Sat Apr 28 19:40:52 2012
@@ -16,7 +16,14 @@
  */
 #ifndef AVRO_ENCODING_H
 #define AVRO_ENCODING_H
-#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#define CLOSE_EXTERN }
+#else
+#define CLOSE_EXTERN
+#endif
+
+#include <avro/platform.h>
 #include "avro/io.h"
 
 /*
@@ -95,5 +102,5 @@ typedef struct avro_encoding_t avro_enco
 extern const avro_encoding_t avro_binary_encoding;	/* in
 							 * encoding_binary 
 							 */
-
+CLOSE_EXTERN
 #endif

Modified: avro/trunk/lang/c/src/encoding_binary.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/encoding_binary.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/encoding_binary.c (original)
+++ avro/trunk/lang/c/src/encoding_binary.c Sat Apr 28 19:40:52 2012
@@ -23,7 +23,6 @@
 #include <limits.h>
 #include <errno.h>
 #include <string.h>
-#include <sys/types.h>
 
 #define MAX_VARINT_BUF_SIZE 10
 
@@ -128,7 +127,7 @@ static int read_bytes(avro_reader_t read
 	int rval;
 	check_prefix(rval, read_long(reader, len),
 		     "Cannot read bytes length: ");
-	*bytes = avro_malloc(*len + 1);
+	*bytes = (char *) avro_malloc(*len + 1);
 	if (!*bytes) {
 		avro_set_error("Cannot allocate buffer for bytes value");
 		return ENOMEM;
@@ -177,7 +176,7 @@ static int read_string(avro_reader_t rea
 	check_prefix(rval, read_long(reader, &str_len),
 		     "Cannot read string length: ");
 	*len = str_len + 1;
-	*s = avro_malloc(*len);
+	*s = (char *) avro_malloc(*len);
 	if (!*s) {
 		avro_set_error("Cannot allocate buffer for string value");
 		return ENOMEM;
@@ -206,14 +205,14 @@ static int64_t size_string(avro_writer_t
 
 static int read_float(avro_reader_t reader, float *f)
 {
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	uint8_t buf[4];
 #endif
 	union {
 		float f;
 		int32_t i;
 	} v;
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	AVRO_READ(reader, buf, 4);
 	v.i = ((int32_t) buf[0] << 0)
 	    | ((int32_t) buf[1] << 8)
@@ -233,7 +232,7 @@ static int skip_float(avro_reader_t read
 
 static int write_float(avro_writer_t writer, const float f)
 {
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	uint8_t buf[4];
 #endif
 	union {
@@ -242,7 +241,7 @@ static int write_float(avro_writer_t wri
 	} v;
 
 	v.f = f;
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	buf[0] = (uint8_t) (v.i >> 0);
 	buf[1] = (uint8_t) (v.i >> 8);
 	buf[2] = (uint8_t) (v.i >> 16);
@@ -264,7 +263,7 @@ static int64_t size_float(avro_writer_t 
 
 static int read_double(avro_reader_t reader, double *d)
 {
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	uint8_t buf[8];
 #endif
 	union {
@@ -272,7 +271,7 @@ static int read_double(avro_reader_t rea
 		int64_t l;
 	} v;
 
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	AVRO_READ(reader, buf, 8);
 	v.l = ((int64_t) buf[0] << 0)
 	    | ((int64_t) buf[1] << 8)
@@ -296,7 +295,7 @@ static int skip_double(avro_reader_t rea
 
 static int write_double(avro_writer_t writer, const double d)
 {
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	uint8_t buf[8];
 #endif
 	union {
@@ -305,7 +304,7 @@ static int write_double(avro_writer_t wr
 	} v;
 
 	v.d = d;
-#if BYTE_ORDER == BIG_ENDIAN
+#if AVRO_PLATFORM_IS_BIG_ENDIAN
 	buf[0] = (uint8_t) (v.l >> 0);
 	buf[1] = (uint8_t) (v.l >> 8);
 	buf[2] = (uint8_t) (v.l >> 16);
@@ -382,62 +381,66 @@ static int64_t size_null(avro_writer_t w
 	return 0;
 }
 
+/* Win32 doesn't support the C99 method of initializing named elements
+ * in a struct declaration. So hide the named parameters for Win32,
+ * and initialize in the order the code was written.
+ */
 const avro_encoding_t avro_binary_encoding = {
-	.description = "BINARY FORMAT",
+	/* .description = */ "BINARY FORMAT",
 	/*
 	 * string 
 	 */
-	.read_string = read_string,
-	.skip_string = skip_string,
-	.write_string = write_string,
-	.size_string = size_string,
+	/* .read_string = */ read_string,
+	/* .skip_string = */ skip_string,
+	/* .write_string = */ write_string,
+	/* .size_string = */ size_string,
 	/*
 	 * bytes 
 	 */
-	.read_bytes = read_bytes,
-	.skip_bytes = skip_bytes,
-	.write_bytes = write_bytes,
-	.size_bytes = size_bytes,
+	/* .read_bytes = */ read_bytes,
+	/* .skip_bytes = */ skip_bytes,
+	/* .write_bytes = */ write_bytes,
+	/* .size_bytes = */ size_bytes,
 	/*
 	 * int 
 	 */
-	.read_int = read_int,
-	.skip_int = skip_int,
-	.write_int = write_int,
-	.size_int = size_int,
+	/* .read_int = */ read_int,
+	/* .skip_int = */ skip_int,
+	/* .write_int = */ write_int,
+	/* .size_int = */ size_int,
 	/*
 	 * long 
 	 */
-	.read_long = read_long,
-	.skip_long = skip_long,
-	.write_long = write_long,
-	.size_long = size_long,
+	/* .read_long = */ read_long,
+	/* .skip_long = */ skip_long,
+	/* .write_long = */ write_long,
+	/* .size_long = */ size_long,
 	/*
 	 * float 
 	 */
-	.read_float = read_float,
-	.skip_float = skip_float,
-	.write_float = write_float,
-	.size_float = size_float,
+	/* .read_float = */ read_float,
+	/* .skip_float = */ skip_float,
+	/* .write_float = */ write_float,
+	/* .size_float = */ size_float,
 	/*
 	 * double 
 	 */
-	.read_double = read_double,
-	.skip_double = skip_double,
-	.write_double = write_double,
-	.size_double = size_double,
+	/* .read_double = */ read_double,
+	/* .skip_double = */ skip_double,
+	/* .write_double = */ write_double,
+	/* .size_double = */ size_double,
 	/*
 	 * boolean 
 	 */
-	.read_boolean = read_boolean,
-	.skip_boolean = skip_boolean,
-	.write_boolean = write_boolean,
-	.size_boolean = size_boolean,
+	/* .read_boolean = */ read_boolean,
+	/* .skip_boolean = */ skip_boolean,
+	/* .write_boolean = */ write_boolean,
+	/* .size_boolean = */ size_boolean,
 	/*
 	 * null 
 	 */
-	.read_null = read_skip_null,
-	.skip_null = read_skip_null,
-	.write_null = write_null,
-	.size_null = size_null
+	/* .read_null = */ read_skip_null,
+	/* .skip_null = */ read_skip_null,
+	/* .write_null = */ write_null,
+	/* .size_null = */ size_null
 };

Modified: avro/trunk/lang/c/src/generic.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/generic.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/generic.c (original)
+++ avro/trunk/lang/c/src/generic.c Sat Apr 28 19:40:52 2012
@@ -15,7 +15,7 @@
  * permissions and limitations under the License.
  */
 
-#include <stdint.h>
+#include <avro/platform.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -65,8 +65,8 @@ avro_generic_value_new(avro_value_iface_
 		return ENOMEM;
 	}
 
-	volatile int  *refcount = self;
-	self += sizeof(volatile int);
+	volatile int  *refcount = (volatile int *) self;
+	self = (char *) self + sizeof(volatile int);
 
 	*refcount = 1;
 	rval = avro_value_init(giface, self);
@@ -90,7 +90,7 @@ avro_generic_value_free(const avro_value
 		    container_of(iface, avro_generic_value_iface_t, parent);
 		size_t  instance_size = avro_value_instance_size(giface);
 		avro_value_done(giface, self);
-		self -= sizeof(volatile int);
+		self = (char *) self - sizeof(volatile int);
 		avro_free(self, instance_size + sizeof(volatile int));
 	}
 }
@@ -102,7 +102,7 @@ avro_generic_value_incref(avro_value_t *
 	 * This only works if you pass in the top-level value.
 	 */
 
-	volatile int  *refcount = (value->self - sizeof(volatile int));
+	volatile int  *refcount = (volatile int *) ((char *) value->self - sizeof(volatile int));
 	avro_refcount_inc(refcount);
 }
 
@@ -113,7 +113,7 @@ avro_generic_value_decref(avro_value_t *
 	 * This only works if you pass in the top-level value.
 	 */
 
-	volatile int  *refcount = (value->self - sizeof(volatile int));
+	volatile int  *refcount = (volatile int *) ((char *) value->self - sizeof(volatile int));
 	if (avro_refcount_dec(refcount)) {
 		avro_generic_value_free(value->iface, value->self);
 	}
@@ -193,7 +193,7 @@ static int
 avro_generic_link_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_reset(self);
 }
 
@@ -201,7 +201,7 @@ static avro_type_t
 avro_generic_link_get_type(const avro_value_iface_t *viface, const void *vself)
 {
 	AVRO_UNUSED(viface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_type(self);
 }
 
@@ -209,7 +209,7 @@ static avro_schema_t
 avro_generic_link_get_schema(const avro_value_iface_t *viface, const void *vself)
 {
 	AVRO_UNUSED(viface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_schema(self);
 }
 
@@ -218,7 +218,7 @@ avro_generic_link_get_boolean(const avro
 			      const void *vself, int *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_boolean(self, out);
 }
 
@@ -227,7 +227,7 @@ avro_generic_link_get_bytes(const avro_v
 			    const void *vself, const void **buf, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_bytes(self, buf, size);
 }
 
@@ -236,7 +236,7 @@ avro_generic_link_grab_bytes(const avro_
 			     const void *vself, avro_wrapped_buffer_t *dest)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_grab_bytes(self, dest);
 }
 
@@ -245,7 +245,7 @@ avro_generic_link_get_double(const avro_
 			     const void *vself, double *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_double(self, out);
 }
 
@@ -254,7 +254,7 @@ avro_generic_link_get_float(const avro_v
 			    const void *vself, float *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_float(self, out);
 }
 
@@ -263,7 +263,7 @@ avro_generic_link_get_int(const avro_val
 			  const void *vself, int32_t *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_int(self, out);
 }
 
@@ -272,7 +272,7 @@ avro_generic_link_get_long(const avro_va
 			   const void *vself, int64_t *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_long(self, out);
 }
 
@@ -280,7 +280,7 @@ static int
 avro_generic_link_get_null(const avro_value_iface_t *iface, const void *vself)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_null(self);
 }
 
@@ -289,7 +289,7 @@ avro_generic_link_get_string(const avro_
 			     const void *vself, const char **str, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_string(self, str, size);
 }
 
@@ -298,7 +298,7 @@ avro_generic_link_grab_string(const avro
 			      const void *vself, avro_wrapped_buffer_t *dest)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_grab_string(self, dest);
 }
 
@@ -307,7 +307,7 @@ avro_generic_link_get_enum(const avro_va
 			   const void *vself, int *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_enum(self, out);
 }
 
@@ -316,7 +316,7 @@ avro_generic_link_get_fixed(const avro_v
 			    const void *vself, const void **buf, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_fixed(self, buf, size);
 }
 
@@ -325,7 +325,7 @@ avro_generic_link_grab_fixed(const avro_
 			     const void *vself, avro_wrapped_buffer_t *dest)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_grab_fixed(self, dest);
 }
 
@@ -334,7 +334,7 @@ avro_generic_link_set_boolean(const avro
 			      void *vself, int val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_boolean(self, val);
 }
 
@@ -343,7 +343,7 @@ avro_generic_link_set_bytes(const avro_v
 			    void *vself, void *buf, size_t size)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_bytes(self, buf, size);
 }
 
@@ -352,7 +352,7 @@ avro_generic_link_give_bytes(const avro_
 			     void *vself, avro_wrapped_buffer_t *buf)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_give_bytes(self, buf);
 }
 
@@ -361,7 +361,7 @@ avro_generic_link_set_double(const avro_
 			     void *vself, double val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_double(self, val);
 }
 
@@ -370,7 +370,7 @@ avro_generic_link_set_float(const avro_v
 			    void *vself, float val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_float(self, val);
 }
 
@@ -379,7 +379,7 @@ avro_generic_link_set_int(const avro_val
 			  void *vself, int32_t val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_int(self, val);
 }
 
@@ -388,7 +388,7 @@ avro_generic_link_set_long(const avro_va
 			   void *vself, int64_t val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_long(self, val);
 }
 
@@ -396,7 +396,7 @@ static int
 avro_generic_link_set_null(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_null(self);
 }
 
@@ -405,7 +405,7 @@ avro_generic_link_set_string(const avro_
 			     void *vself, const char *str)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_string(self, str);
 }
 
@@ -414,7 +414,7 @@ avro_generic_link_set_string_len(const a
 				 void *vself, const char *str, size_t size)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_string_len(self, str, size);
 }
 
@@ -423,7 +423,7 @@ avro_generic_link_give_string_len(const 
 				  void *vself, avro_wrapped_buffer_t *buf)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_give_string_len(self, buf);
 }
 
@@ -432,7 +432,7 @@ avro_generic_link_set_enum(const avro_va
 			   void *vself, int val)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_enum(self, val);
 }
 
@@ -441,7 +441,7 @@ avro_generic_link_set_fixed(const avro_v
 			    void *vself, void *buf, size_t size)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_fixed(self, buf, size);
 }
 
@@ -450,7 +450,7 @@ avro_generic_link_give_fixed(const avro_
 			     void *vself, avro_wrapped_buffer_t *buf)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_give_fixed(self, buf);
 }
 
@@ -459,7 +459,7 @@ avro_generic_link_get_size(const avro_va
 			   const void *vself, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_size(self, size);
 }
 
@@ -469,7 +469,7 @@ avro_generic_link_get_by_index(const avr
 			       avro_value_t *child, const char **name)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_by_index(self, index, child, name);
 }
 
@@ -479,7 +479,7 @@ avro_generic_link_get_by_name(const avro
 			      avro_value_t *child, size_t *index)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_by_name(self, name, child, index);
 }
 
@@ -488,7 +488,7 @@ avro_generic_link_get_discriminant(const
 				   const void *vself, int *out)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_discriminant(self, out);
 }
 
@@ -497,7 +497,7 @@ avro_generic_link_get_current_branch(con
 				     const void *vself, avro_value_t *branch)
 {
 	AVRO_UNUSED(iface);
-	const avro_value_t  *self = vself;
+	const avro_value_t  *self = (const avro_value_t *) vself;
 	return avro_value_get_current_branch(self, branch);
 }
 
@@ -507,7 +507,7 @@ avro_generic_link_append(const avro_valu
 			 size_t *new_index)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_append(self, child_out, new_index);
 }
 
@@ -517,7 +517,7 @@ avro_generic_link_add(const avro_value_i
 		      avro_value_t *child, size_t *index, int *is_new)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_add(self, key, child, index, is_new);
 }
 
@@ -527,7 +527,7 @@ avro_generic_link_set_branch(const avro_
 			     avro_value_t *branch)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	return avro_value_set_branch(self, discriminant, branch);
 }
 
@@ -546,7 +546,7 @@ avro_generic_link_init(const avro_value_
 	avro_generic_link_value_iface_t  *iface =
 	    container_of(viface, avro_generic_link_value_iface_t, parent.parent);
 
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	size_t  target_instance_size =
 	    avro_value_instance_size(iface->target_giface);
 	if (target_instance_size == 0) {
@@ -570,7 +570,7 @@ static void
 avro_generic_link_done(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_value_t  *self = vself;
+	avro_value_t  *self = (avro_value_t *) vself;
 	avro_generic_value_iface_t  *target_giface =
 	    container_of(self->iface, avro_generic_value_iface_t, parent);
 	size_t  target_instance_size = avro_value_instance_size(target_giface);
@@ -646,7 +646,7 @@ avro_generic_link_class(avro_schema_t sc
 	}
 
 	avro_generic_link_value_iface_t  *iface =
-		avro_new(avro_generic_link_value_iface_t);
+		(avro_generic_link_value_iface_t *) avro_new(avro_generic_link_value_iface_t);
 	if (iface == NULL) {
 		return NULL;
 	}
@@ -667,7 +667,7 @@ static int
 avro_generic_boolean_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -693,7 +693,7 @@ avro_generic_boolean_get(const avro_valu
 			 const void *vself, int *out)
 {
 	AVRO_UNUSED(iface);
-	const int  *self = vself;
+	const int  *self = (const int *) vself;
 	*out = *self;
 	return 0;
 }
@@ -703,7 +703,7 @@ avro_generic_boolean_set(const avro_valu
 			 void *vself, int val)
 {
 	AVRO_UNUSED(iface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = val;
 	return 0;
 }
@@ -719,7 +719,7 @@ static int
 avro_generic_boolean_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -810,7 +810,7 @@ static int
 avro_generic_bytes_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_clear(self);
 	return 0;
 }
@@ -836,7 +836,7 @@ avro_generic_bytes_get(const avro_value_
 		       const void *vself, const void **buf, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_raw_string_t  *self = vself;
+	const avro_raw_string_t  *self = (const avro_raw_string_t *) vself;
 	if (buf != NULL) {
 		*buf = avro_raw_string_get(self);
 	}
@@ -851,7 +851,7 @@ avro_generic_bytes_grab(const avro_value
 			const void *vself, avro_wrapped_buffer_t *dest)
 {
 	AVRO_UNUSED(iface);
-	const avro_raw_string_t  *self = vself;
+	const avro_raw_string_t  *self = (const avro_raw_string_t *) vself;
 	return avro_raw_string_grab(self, dest);
 }
 
@@ -861,7 +861,7 @@ avro_generic_bytes_set(const avro_value_
 {
 	AVRO_UNUSED(iface);
 	check_param(EINVAL, buf != NULL, "bytes contents");
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_set_length(self, buf, size);
 	return 0;
 }
@@ -871,7 +871,7 @@ avro_generic_bytes_give(const avro_value
 			void *vself, avro_wrapped_buffer_t *buf)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_give(self, buf);
 	return 0;
 }
@@ -887,7 +887,7 @@ static int
 avro_generic_bytes_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_init(self);
 	return 0;
 }
@@ -896,7 +896,7 @@ static void
 avro_generic_bytes_done(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_done(self);
 }
 
@@ -979,7 +979,7 @@ static int
 avro_generic_double_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	double  *self = vself;
+	double  *self = (double *) vself;
 	*self = 0.0;
 	return 0;
 }
@@ -1005,7 +1005,7 @@ avro_generic_double_get(const avro_value
 			const void *vself, double *out)
 {
 	AVRO_UNUSED(iface);
-	const double  *self = vself;
+	const double  *self = (const double *) vself;
 	*out = *self;
 	return 0;
 }
@@ -1015,7 +1015,7 @@ avro_generic_double_set(const avro_value
 			void *vself, double val)
 {
 	AVRO_UNUSED(iface);
-	double  *self = vself;
+	double  *self = (double *) vself;
 	*self = val;
 	return 0;
 }
@@ -1031,7 +1031,7 @@ static int
 avro_generic_double_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	double  *self = vself;
+	double  *self = (double *) vself;
 	*self = 0.0;
 	return 0;
 }
@@ -1122,7 +1122,7 @@ static int
 avro_generic_float_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	float  *self = vself;
+	float  *self = (float *) vself;
 	*self = 0.0f;
 	return 0;
 }
@@ -1148,7 +1148,7 @@ avro_generic_float_get(const avro_value_
 		       const void *vself, float *out)
 {
 	AVRO_UNUSED(iface);
-	const float  *self = vself;
+	const float  *self = (const float *) vself;
 	*out = *self;
 	return 0;
 }
@@ -1158,7 +1158,7 @@ avro_generic_float_set(const avro_value_
 		       void *vself, float val)
 {
 	AVRO_UNUSED(iface);
-	float  *self = vself;
+	float  *self = (float *) vself;
 	*self = val;
 	return 0;
 }
@@ -1174,7 +1174,7 @@ static int
 avro_generic_float_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	float  *self = vself;
+	float  *self = (float *) vself;
 	*self = 0.0f;
 	return 0;
 }
@@ -1265,7 +1265,7 @@ static int
 avro_generic_int_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int32_t  *self = vself;
+	int32_t  *self = (int32_t *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1291,7 +1291,7 @@ avro_generic_int_get(const avro_value_if
 		     const void *vself, int32_t *out)
 {
 	AVRO_UNUSED(iface);
-	const int32_t  *self = vself;
+	const int32_t  *self = (const int32_t *) vself;
 	*out = *self;
 	return 0;
 }
@@ -1301,7 +1301,7 @@ avro_generic_int_set(const avro_value_if
 		     void *vself, int32_t val)
 {
 	AVRO_UNUSED(iface);
-	int32_t  *self = vself;
+	int32_t  *self = (int32_t *) vself;
 	*self = val;
 	return 0;
 }
@@ -1317,7 +1317,7 @@ static int
 avro_generic_int_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int32_t  *self = vself;
+	int32_t  *self = (int32_t *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1408,7 +1408,7 @@ static int
 avro_generic_long_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int64_t  *self = vself;
+	int64_t  *self = (int64_t *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1434,7 +1434,7 @@ avro_generic_long_get(const avro_value_i
 		      const void *vself, int64_t *out)
 {
 	AVRO_UNUSED(iface);
-	const int64_t  *self = vself;
+	const int64_t  *self = (const int64_t *) vself;
 	*out = *self;
 	return 0;
 }
@@ -1444,7 +1444,7 @@ avro_generic_long_set(const avro_value_i
 		      void *vself, int64_t val)
 {
 	AVRO_UNUSED(iface);
-	int64_t  *self = vself;
+	int64_t  *self = (int64_t *) vself;
 	*self = val;
 	return 0;
 }
@@ -1460,7 +1460,7 @@ static int
 avro_generic_long_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int64_t  *self = vself;
+	int64_t  *self = (int64_t *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1551,7 +1551,7 @@ static int
 avro_generic_null_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1599,7 +1599,7 @@ static int
 avro_generic_null_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -1688,7 +1688,7 @@ static int
 avro_generic_string_reset(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_clear(self);
 	return 0;
 }
@@ -1714,8 +1714,8 @@ avro_generic_string_get(const avro_value
 			const void *vself, const char **str, size_t *size)
 {
 	AVRO_UNUSED(iface);
-	const avro_raw_string_t  *self = vself;
-	const char  *contents = avro_raw_string_get(self);
+	const avro_raw_string_t  *self = (const avro_raw_string_t *) vself;
+	const char  *contents = (const char *) avro_raw_string_get(self);
 
 	if (str != NULL) {
 		/*
@@ -1738,8 +1738,8 @@ avro_generic_string_grab(const avro_valu
 			 const void *vself, avro_wrapped_buffer_t *dest)
 {
 	AVRO_UNUSED(iface);
-	const avro_raw_string_t  *self = vself;
-	const char  *contents = avro_raw_string_get(self);
+	const avro_raw_string_t  *self = (const avro_raw_string_t *) vself;
+	const char  *contents = (const char *) avro_raw_string_get(self);
 
 	if (contents == NULL) {
 		return avro_wrapped_buffer_new(dest, "", 1);
@@ -1760,7 +1760,7 @@ avro_generic_string_set(const avro_value
 	 * terminator from val, and will include the NUL terminator in
 	 * the raw_string's length, which is what we want.
 	 */
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_set(self, val);
 	return 0;
 }
@@ -1771,7 +1771,7 @@ avro_generic_string_set_length(const avr
 {
 	AVRO_UNUSED(iface);
 	check_param(EINVAL, val != NULL, "string contents");
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_set_length(self, val, size);
 	return 0;
 }
@@ -1781,7 +1781,7 @@ avro_generic_string_give_length(const av
 				void *vself, avro_wrapped_buffer_t *buf)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_give(self, buf);
 	return 0;
 }
@@ -1797,7 +1797,7 @@ static int
 avro_generic_string_init(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_init(self);
 	return 0;
 }
@@ -1806,7 +1806,7 @@ static void
 avro_generic_string_done(const avro_value_iface_t *iface, void *vself)
 {
 	AVRO_UNUSED(iface);
-	avro_raw_string_t  *self = vself;
+	avro_raw_string_t  *self = (avro_raw_string_t *) vself;
 	avro_raw_string_done(self);
 }
 
@@ -1949,7 +1949,7 @@ avro_generic_array_reset(const avro_valu
 {
 	const avro_generic_array_value_iface_t  *iface =
 	    container_of(viface, avro_generic_array_value_iface_t, parent);
-	avro_generic_array_t  *self = vself;
+	avro_generic_array_t  *self = (avro_generic_array_t *) vself;
 	avro_generic_array_free_elements(iface->child_giface, self);
 	avro_raw_array_clear(&self->array);
 	return 0;
@@ -1977,7 +1977,7 @@ avro_generic_array_get_size(const avro_v
 			    const void *vself, size_t *size)
 {
 	AVRO_UNUSED(viface);
-	const avro_generic_array_t  *self = vself;
+	const avro_generic_array_t  *self = (const avro_generic_array_t *) vself;
 	if (size != NULL) {
 		*size = avro_raw_array_size(&self->array);
 	}
@@ -1992,9 +1992,9 @@ avro_generic_array_get_by_index(const av
 	const avro_generic_array_value_iface_t  *iface =
 	    container_of(viface, avro_generic_array_value_iface_t, parent);
 	AVRO_UNUSED(name);
-	const avro_generic_array_t  *self = vself;
+	const avro_generic_array_t  *self = (avro_generic_array_t *) vself;
 	if (index >= avro_raw_array_size(&self->array)) {
-		avro_set_error("Array index %zu out of range", index);
+		avro_set_error("Array index %" PRIsz " out of range", index);
 		return EINVAL;
 	}
 	child->iface = &iface->child_giface->parent;
@@ -2010,7 +2010,7 @@ avro_generic_array_append(const avro_val
 	int  rval;
 	const avro_generic_array_value_iface_t  *iface =
 	    container_of(viface, avro_generic_array_value_iface_t, parent);
-	avro_generic_array_t  *self = vself;
+	avro_generic_array_t  *self = (avro_generic_array_t *) vself;
 	child->iface = &iface->child_giface->parent;
 	child->self = avro_raw_array_append(&self->array);
 	if (child->self == NULL) {
@@ -2036,7 +2036,7 @@ avro_generic_array_init(const avro_value
 {
 	const avro_generic_array_value_iface_t  *iface =
 	    container_of(viface, avro_generic_array_value_iface_t, parent);
-	avro_generic_array_t  *self = vself;
+	avro_generic_array_t  *self = (avro_generic_array_t *) vself;
 
 	size_t  child_size = avro_value_instance_size(iface->child_giface);
 	avro_raw_array_init(&self->array, child_size);
@@ -2048,7 +2048,7 @@ avro_generic_array_done(const avro_value
 {
 	const avro_generic_array_value_iface_t  *iface =
 	    container_of(viface, avro_generic_array_value_iface_t, parent);
-	avro_generic_array_t  *self = vself;
+	avro_generic_array_t  *self = (avro_generic_array_t *) vself;
 	avro_generic_array_free_elements(iface->child_giface, self);
 	avro_raw_array_done(&self->array);
 }
@@ -2128,7 +2128,7 @@ avro_generic_array_class(avro_schema_t s
 	}
 
 	avro_generic_array_value_iface_t  *iface =
-		avro_new(avro_generic_array_value_iface_t);
+		(avro_generic_array_value_iface_t *) avro_new(avro_generic_array_value_iface_t);
 	if (iface == NULL) {
 		avro_value_iface_decref(&child_giface->parent);
 		return NULL;
@@ -2182,7 +2182,7 @@ static int
 avro_generic_enum_reset(const avro_value_iface_t *viface, void *vself)
 {
 	AVRO_UNUSED(viface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -2209,7 +2209,7 @@ avro_generic_enum_get(const avro_value_i
 		      const void *vself, int *out)
 {
 	AVRO_UNUSED(viface);
-	const int  *self = vself;
+	const int  *self = (const int *) vself;
 	*out = *self;
 	return 0;
 }
@@ -2219,7 +2219,7 @@ avro_generic_enum_set(const avro_value_i
 		      void *vself, int val)
 {
 	AVRO_UNUSED(viface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = val;
 	return 0;
 }
@@ -2235,7 +2235,7 @@ static int
 avro_generic_enum_init(const avro_value_iface_t *viface, void *vself)
 {
 	AVRO_UNUSED(viface);
-	int  *self = vself;
+	int  *self = (int *) vself;
 	*self = 0;
 	return 0;
 }
@@ -2308,7 +2308,7 @@ static avro_generic_value_iface_t *
 avro_generic_enum_class(avro_schema_t schema)
 {
 	avro_generic_enum_value_iface_t  *iface =
-		avro_new(avro_generic_enum_value_iface_t);
+		(avro_generic_enum_value_iface_t *) avro_new(avro_generic_enum_value_iface_t);
 	if (iface == NULL) {
 		return NULL;
 	}
@@ -2512,7 +2512,7 @@ static avro_generic_value_iface_t *
 avro_generic_fixed_class(avro_schema_t schema)
 {
 	avro_generic_fixed_value_iface_t  *iface =
-		avro_new(avro_generic_fixed_value_iface_t);
+		(avro_generic_fixed_value_iface_t *) avro_new(avro_generic_fixed_value_iface_t);
 	if (iface == NULL) {
 		return NULL;
 	}
@@ -2584,7 +2584,7 @@ avro_generic_map_reset(const avro_value_
 {
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
-	avro_generic_map_t  *self = vself;
+	avro_generic_map_t  *self = (avro_generic_map_t *) vself;
 	avro_generic_map_free_elements(iface->child_giface, self);
 	avro_raw_map_clear(&self->map);
 	return 0;
@@ -2612,7 +2612,7 @@ avro_generic_map_get_size(const avro_val
 			  const void *vself, size_t *size)
 {
 	AVRO_UNUSED(viface);
-	const avro_generic_map_t  *self = vself;
+	const avro_generic_map_t  *self = (const avro_generic_map_t *) vself;
 	if (size != NULL) {
 		*size = avro_raw_map_size(&self->map);
 	}
@@ -2626,9 +2626,9 @@ avro_generic_map_get_by_index(const avro
 {
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
-	const avro_generic_map_t  *self = vself;
+	const avro_generic_map_t  *self = (const avro_generic_map_t *) vself;
 	if (index >= avro_raw_map_size(&self->map)) {
-		avro_set_error("Map index %zu out of range", index);
+		avro_set_error("Map index %" PRIsz " out of range", index);
 		return EINVAL;
 	}
 	child->iface = &iface->child_giface->parent;
@@ -2646,7 +2646,7 @@ avro_generic_map_get_by_name(const avro_
 {
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
-	const avro_generic_map_t  *self = vself;
+	const avro_generic_map_t  *self = (const avro_generic_map_t *) vself;
 	child->iface = &iface->child_giface->parent;
 	child->self = avro_raw_map_get(&self->map, name, index);
 	return 0;
@@ -2660,7 +2660,7 @@ avro_generic_map_add(const avro_value_if
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
 	int  rval;
-	avro_generic_map_t  *self = vself;
+	avro_generic_map_t  *self = (avro_generic_map_t *) vself;
 	child->iface = &iface->child_giface->parent;
 	rval = avro_raw_map_get_or_create(&self->map, key,
 					  &child->self, index);
@@ -2688,7 +2688,7 @@ avro_generic_map_init(const avro_value_i
 {
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
-	avro_generic_map_t  *self = vself;
+	avro_generic_map_t  *self = (avro_generic_map_t *) vself;
 
 	size_t  child_size = avro_value_instance_size(iface->child_giface);
 	avro_raw_map_init(&self->map, child_size);
@@ -2700,7 +2700,7 @@ avro_generic_map_done(const avro_value_i
 {
 	const avro_generic_map_value_iface_t  *iface =
 	    container_of(viface, avro_generic_map_value_iface_t, parent);
-	avro_generic_map_t  *self = vself;
+	avro_generic_map_t  *self = (avro_generic_map_t *) vself;
 	avro_generic_map_free_elements(iface->child_giface, self);
 	avro_raw_map_done(&self->map);
 }
@@ -2780,7 +2780,7 @@ avro_generic_map_class(avro_schema_t sch
 	}
 
 	avro_generic_map_value_iface_t  *iface =
-		avro_new(avro_generic_map_value_iface_t);
+		(avro_generic_map_value_iface_t *) avro_new(avro_generic_map_value_iface_t);
 	if (iface == NULL) {
 		avro_value_iface_decref(&child_giface->parent);
 		return NULL;
@@ -2845,7 +2845,7 @@ typedef struct avro_generic_record {
 
 /** Return a pointer to the given field within a record struct. */
 #define avro_generic_record_field(iface, rec, index) \
-	(((void *) (rec)) + (iface)->field_offsets[(index)])
+	(((char *) (rec)) + (iface)->field_offsets[(index)])
 
 
 static avro_value_iface_t *
@@ -2886,7 +2886,7 @@ avro_generic_record_reset(const avro_val
 	const avro_generic_record_value_iface_t  *iface =
 	    container_of(viface, avro_generic_record_value_iface_t, parent);
 	int  rval;
-	avro_generic_record_t  *self = vself;
+	avro_generic_record_t  *self = (avro_generic_record_t *) vself;
 	size_t  i;
 	for (i = 0; i < iface->field_count; i++) {
 		avro_value_t  value = {
@@ -2935,9 +2935,9 @@ avro_generic_record_get_by_index(const a
 {
 	const avro_generic_record_value_iface_t  *iface =
 	    container_of(viface, avro_generic_record_value_iface_t, parent);
-	const avro_generic_record_t  *self = vself;
+	const avro_generic_record_t  *self = (const avro_generic_record_t *) vself;
 	if (index >= iface->field_count) {
-		avro_set_error("Field index %zu out of range", index);
+		avro_set_error("Field index %" PRIsz " out of range", index);
 		return EINVAL;
 	}
 	child->iface = &iface->field_ifaces[index]->parent;
@@ -2961,7 +2961,7 @@ avro_generic_record_get_by_name(const av
 {
 	const avro_generic_record_value_iface_t  *iface =
 	    container_of(viface, avro_generic_record_value_iface_t, parent);
-	const avro_generic_record_t  *self = vself;
+	const avro_generic_record_t  *self = (const avro_generic_record_t *) vself;
 
 	avro_schema_t  schema = iface->schema;
 	int  index = avro_schema_record_field_get_index(schema, name);
@@ -2992,7 +2992,7 @@ avro_generic_record_init(const avro_valu
 	int  rval;
 	const avro_generic_record_value_iface_t  *iface =
 	    container_of(viface, avro_generic_record_value_iface_t, parent);
-	avro_generic_record_t  *self = vself;
+	avro_generic_record_t  *self = (avro_generic_record_t *) vself;
 
 	/* Initialize each field */
 	size_t  i;
@@ -3010,7 +3010,7 @@ avro_generic_record_done(const avro_valu
 {
 	const avro_generic_record_value_iface_t  *iface =
 	    container_of(viface, avro_generic_record_value_iface_t, parent);
-	avro_generic_record_t  *self = vself;
+	avro_generic_record_t  *self = (avro_generic_record_t *) vself;
 	size_t  i;
 	for (i = 0; i < iface->field_count; i++) {
 		avro_value_done(iface->field_ifaces[i],
@@ -3079,7 +3079,7 @@ static avro_generic_value_iface_t *
 avro_generic_record_class(avro_schema_t schema, memoize_state_t *state)
 {
 	avro_generic_record_value_iface_t  *iface =
-		avro_new(avro_generic_record_value_iface_t);
+		(avro_generic_record_value_iface_t *) avro_new(avro_generic_record_value_iface_t);
 	if (iface == NULL) {
 		return NULL;
 	}
@@ -3095,26 +3095,26 @@ avro_generic_record_class(avro_schema_t 
 	size_t  field_ifaces_size =
 		sizeof(avro_generic_value_iface_t *) * iface->field_count;
 
-	iface->field_offsets = avro_malloc(field_offsets_size);
+	iface->field_offsets = (size_t *) avro_malloc(field_offsets_size);
 	if (iface->field_offsets == NULL) {
 		goto error;
 	}
 
-	iface->field_ifaces = avro_malloc(field_ifaces_size);
+	iface->field_ifaces = (avro_generic_value_iface_t **) avro_malloc(field_ifaces_size);
 	if (iface->field_ifaces == NULL) {
 		goto error;
 	}
 
 	size_t  next_offset = sizeof(avro_generic_record_t);
 #if DEBUG_FIELD_OFFSETS
-	fprintf(stderr, "  Record %s\n  Header: Offset 0, size %zu\n",
+	fprintf(stderr, "  Record %s\n  Header: Offset 0, size %" PRIsz "\n",
 		avro_schema_type_name(schema),
 		sizeof(avro_generic_record_t));
 #endif
 	size_t  i;
 	for (i = 0; i < iface->field_count; i++) {
 #if DEBUG_FIELD_OFFSETS
-		fprintf(stderr, "  Field %zu:\n", i);
+		fprintf(stderr, "  Field %" PRIsz ":\n", i);
 #endif
 		avro_schema_t  field_schema =
 		    avro_schema_record_field_get_by_index(schema, i);
@@ -3139,7 +3139,7 @@ avro_generic_record_class(avro_schema_t 
 		}
 
 #if DEBUG_FIELD_OFFSETS
-		fprintf(stderr, "    Offset %zu, size %zu\n",
+		fprintf(stderr, "    Offset %" PRIsz ", size %" PRIsz "\n",
 			next_offset, field_size);
 #endif
 		next_offset += field_size;
@@ -3147,7 +3147,7 @@ avro_generic_record_class(avro_schema_t 
 
 	iface->instance_size = next_offset;
 #if DEBUG_FIELD_OFFSETS
-	fprintf(stderr, "  TOTAL SIZE: %zu\n", next_offset);
+	fprintf(stderr, "  TOTAL SIZE: %" PRIsz "\n", next_offset);
 #endif
 
 	return &iface->parent;
@@ -3223,7 +3223,7 @@ typedef struct avro_generic_union {
 
 /** Return a pointer to the active branch within a union struct. */
 #define avro_generic_union_branch(_union) \
-	(((void *) (_union)) + sizeof(avro_generic_union_t))
+	(((char *) (_union)) + sizeof(avro_generic_union_t))
 
 
 static avro_value_iface_t *
@@ -3261,7 +3261,7 @@ avro_generic_union_reset(const avro_valu
 {
 	const avro_generic_union_value_iface_t  *iface =
 	    container_of(viface, avro_generic_union_value_iface_t, parent);
-	avro_generic_union_t  *self = vself;
+	avro_generic_union_t  *self = (avro_generic_union_t *) vself;
 	/* Keep the same branch selected, for the common case that we're
 	 * about to reuse it. */
 	if (self->discriminant >= 0) {
@@ -3300,7 +3300,7 @@ avro_generic_union_get_discriminant(cons
 				    const void *vself, int *out)
 {
 	AVRO_UNUSED(viface);
-	const avro_generic_union_t  *self = vself;
+	const avro_generic_union_t  *self = (const avro_generic_union_t *) vself;
 	*out = self->discriminant;
 	return 0;
 }
@@ -3311,7 +3311,7 @@ avro_generic_union_get_current_branch(co
 {
 	const avro_generic_union_value_iface_t  *iface =
 	    container_of(viface, avro_generic_union_value_iface_t, parent);
-	const avro_generic_union_t  *self = vself;
+	const avro_generic_union_t  *self = (const avro_generic_union_t *) vself;
 	if (self->discriminant < 0) {
 		avro_set_error("Union has no selected branch");
 		return EINVAL;
@@ -3329,7 +3329,7 @@ avro_generic_union_set_branch(const avro
 	const avro_generic_union_value_iface_t  *iface =
 	    container_of(viface, avro_generic_union_value_iface_t, parent);
 	int  rval;
-	avro_generic_union_t  *self = vself;
+	avro_generic_union_t  *self = (avro_generic_union_t *) vself;
 
 #if DEBUG_BRANCHES
 	fprintf(stderr, "Selecting branch %d (was %d)\n",
@@ -3383,7 +3383,7 @@ static int
 avro_generic_union_init(const avro_value_iface_t *viface, void *vself)
 {
 	AVRO_UNUSED(viface);
-	avro_generic_union_t  *self = vself;
+	avro_generic_union_t  *self = (avro_generic_union_t *) vself;
 	self->discriminant = -1;
 	return 0;
 }
@@ -3393,7 +3393,7 @@ avro_generic_union_done(const avro_value
 {
 	const avro_generic_union_value_iface_t  *iface =
 	    container_of(viface, avro_generic_union_value_iface_t, parent);
-	avro_generic_union_t  *self = vself;
+	avro_generic_union_t  *self = (avro_generic_union_t *) vself;
 	if (self->discriminant >= 0) {
 #if DEBUG_BRANCHES
 		fprintf(stderr, "Finalizing branch %d\n",
@@ -3467,7 +3467,7 @@ static avro_generic_value_iface_t *
 avro_generic_union_class(avro_schema_t schema, memoize_state_t *state)
 {
 	avro_generic_union_value_iface_t  *iface =
-		avro_new(avro_generic_union_value_iface_t);
+		(avro_generic_union_value_iface_t *) avro_new(avro_generic_union_value_iface_t);
 	if (iface == NULL) {
 		return NULL;
 	}
@@ -3481,7 +3481,7 @@ avro_generic_union_class(avro_schema_t s
 	size_t  branch_ifaces_size =
 		sizeof(avro_generic_value_iface_t *) * iface->branch_count;
 
-	iface->branch_ifaces = avro_malloc(branch_ifaces_size);
+	iface->branch_ifaces = (avro_generic_value_iface_t **) avro_malloc(branch_ifaces_size);
 	if (iface->branch_ifaces == NULL) {
 		goto error;
 	}
@@ -3506,7 +3506,7 @@ avro_generic_union_class(avro_schema_t s
 		}
 
 #if DEBUG_BRANCHES
-		fprintf(stderr, "Branch %zu, size %zu\n",
+		fprintf(stderr, "Branch %" PRIsz ", size %" PRIsz "\n",
 			i, branch_size);
 #endif
 
@@ -3518,7 +3518,7 @@ avro_generic_union_class(avro_schema_t s
 	iface->instance_size =
 		sizeof(avro_generic_union_t) + max_branch_size;
 #if DEBUG_BRANCHES
-	fprintf(stderr, "MAX BRANCH SIZE: %zu\n", max_branch_size);
+	fprintf(stderr, "MAX BRANCH SIZE: %" PRIsz "\n", max_branch_size);
 #endif
 
 	return &iface->parent;

Modified: avro/trunk/lang/c/src/io.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/io.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/io.c (original)
+++ avro/trunk/lang/c/src/io.c Sat Apr 28 19:40:52 2012
@@ -95,7 +95,7 @@ static void writer_init(avro_writer_t wr
 avro_reader_t avro_reader_file_fp(FILE * fp, int should_close)
 {
 	struct _avro_reader_file_t *file_reader =
-	    avro_new(struct _avro_reader_file_t);
+	    (struct _avro_reader_file_t *) avro_new(struct _avro_reader_file_t);
 	if (!file_reader) {
 		avro_set_error("Cannot allocate new file reader");
 		return NULL;
@@ -115,7 +115,7 @@ avro_reader_t avro_reader_file(FILE * fp
 avro_writer_t avro_writer_file_fp(FILE * fp, int should_close)
 {
 	struct _avro_writer_file_t *file_writer =
-	    avro_new(struct _avro_writer_file_t);
+	    (struct _avro_writer_file_t *) avro_new(struct _avro_writer_file_t);
 	if (!file_writer) {
 		avro_set_error("Cannot allocate new file writer");
 		return NULL;
@@ -134,7 +134,7 @@ avro_writer_t avro_writer_file(FILE * fp
 avro_reader_t avro_reader_memory(const char *buf, int64_t len)
 {
 	struct _avro_reader_memory_t *mem_reader =
-	    avro_new(struct _avro_reader_memory_t);
+	    (struct _avro_reader_memory_t *) avro_new(struct _avro_reader_memory_t);
 	if (!mem_reader) {
 		avro_set_error("Cannot allocate new memory reader");
 		return NULL;
@@ -160,7 +160,7 @@ avro_reader_memory_set_source(avro_reade
 avro_writer_t avro_writer_memory(const char *buf, int64_t len)
 {
 	struct _avro_writer_memory_t *mem_writer =
-	    avro_new(struct _avro_writer_memory_t);
+	    (struct _avro_writer_memory_t *) avro_new(struct _avro_writer_memory_t);
 	if (!mem_writer) {
 		avro_set_error("Cannot allocate new memory writer");
 		return NULL;
@@ -188,7 +188,7 @@ avro_read_memory(struct _avro_reader_mem
 {
 	if (len > 0) {
 		if ((reader->len - reader->read) < len) {
-			avro_prefix_error("Cannot read %zu bytes from memory buffer",
+			avro_prefix_error("Cannot read %" PRIsz " bytes from memory buffer",
 					  (size_t) len);
 			return ENOSPC;
 		}
@@ -205,7 +205,7 @@ static int
 avro_read_file(struct _avro_reader_file_t *reader, void *buf, int64_t len)
 {
 	int64_t needed = len;
-	void *p = buf;
+	char *p = (char *) buf;
 	int rval;
 
 	if (len == 0) {
@@ -221,7 +221,7 @@ avro_read_file(struct _avro_reader_file_
 		}
 		rval = fread(p, 1, needed, reader->fp);
 		if (rval != needed) {
-			avro_set_error("Cannot read %zu bytes from file",
+			avro_set_error("Cannot read %" PRIsz " bytes from file",
 				       (size_t) needed);
 			return -1;
 		}
@@ -239,7 +239,7 @@ avro_read_file(struct _avro_reader_file_
 		    fread(reader->buffer, 1, sizeof(reader->buffer),
 			  reader->fp);
 		if (rval == 0) {
-			avro_set_error("Cannot read %zu bytes from file",
+			avro_set_error("Cannot read %" PRIsz " bytes from file",
 				       (size_t) needed);
 			return -1;
 		}
@@ -247,7 +247,7 @@ avro_read_file(struct _avro_reader_file_
 		reader->end = reader->cur + rval;
 
 		if (bytes_available(reader) < needed) {
-			avro_set_error("Cannot read %zu bytes from file",
+			avro_set_error("Cannot read %" PRIsz " bytes from file",
 				       (size_t) needed);
 			return -1;
 		}
@@ -255,7 +255,7 @@ avro_read_file(struct _avro_reader_file_
 		reader->cur += needed;
 		return 0;
 	}
-	avro_set_error("Cannot read %zu bytes from file",
+	avro_set_error("Cannot read %" PRIsz " bytes from file",
 		       (size_t) needed);
 	return -1;
 }
@@ -278,7 +278,7 @@ static int avro_skip_memory(struct _avro
 {
 	if (len > 0) {
 		if ((reader->len - reader->read) < len) {
-			avro_set_error("Cannot skip %zu bytes in memory buffer",
+			avro_set_error("Cannot skip %" PRIsz " bytes in memory buffer",
 				       (size_t) len);
 			return ENOSPC;
 		}
@@ -302,7 +302,7 @@ static int avro_skip_file(struct _avro_r
 		buffer_reset(reader);
 		rval = fseek(reader->fp, needed, SEEK_CUR);
 		if (rval < 0) {
-			avro_set_error("Cannot skip %zu bytes in file",
+			avro_set_error("Cannot skip %" PRIsz " bytes in file",
 				       (size_t) len);
 			return rval;
 		}
@@ -328,7 +328,7 @@ avro_write_memory(struct _avro_writer_me
 {
 	if (len) {
 		if ((writer->len - writer->written) < len) {
-			avro_set_error("Cannot write %zu bytes in memory buffer",
+			avro_set_error("Cannot write %" PRIsz " bytes in memory buffer",
 				       (size_t) len);
 			return ENOSPC;
 		}

Modified: avro/trunk/lang/c/src/map.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/map.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/map.c (original)
+++ avro/trunk/lang/c/src/map.c Sat Apr 28 19:40:52 2012
@@ -41,8 +41,8 @@ avro_raw_map_free_keys(avro_raw_map_t *m
 	unsigned int  i;
 	for (i = 0; i < avro_raw_map_size(map); i++) {
 		void  *ventry =
-		    (map->elements.data + map->elements.element_size * i);
-		avro_raw_map_entry_t  *entry = ventry;
+		    ((char *) map->elements.data + map->elements.element_size * i);
+		avro_raw_map_entry_t  *entry = (avro_raw_map_entry_t *) ventry;
 		avro_str_free((char *) entry->key);
 	}
 }
@@ -52,7 +52,7 @@ void avro_raw_map_done(avro_raw_map_t *m
 {
 	avro_raw_map_free_keys(map);
 	avro_raw_array_done(&map->elements);
-	st_free_table(map->indices_by_key);
+	st_free_table((st_table *) map->indices_by_key);
 	memset(map, 0, sizeof(avro_raw_map_t));
 }
 
@@ -61,7 +61,7 @@ void avro_raw_map_clear(avro_raw_map_t *
 {
 	avro_raw_map_free_keys(map);
 	avro_raw_array_clear(&map->elements);
-	st_free_table(map->indices_by_key);
+	st_free_table((st_table *) map->indices_by_key);
 	map->indices_by_key = st_init_strtable();
 }
 
@@ -77,14 +77,14 @@ void *avro_raw_map_get(const avro_raw_ma
 		       size_t *index)
 {
 	st_data_t  data;
-	if (st_lookup(map->indices_by_key, (st_data_t) key, &data)) {
+	if (st_lookup((st_table *) map->indices_by_key, (st_data_t) key, &data)) {
 		unsigned int  i = (unsigned int) data;
 		if (index) {
 			*index = i;
 		}
 		void  *raw_entry =
-		    (map->elements.data + map->elements.element_size * i);
-		return raw_entry + sizeof(avro_raw_map_entry_t);
+		    ((char *) map->elements.data + map->elements.element_size * i);
+		return (char *) raw_entry + sizeof(avro_raw_map_entry_t);
 	} else {
 		return NULL;
 	}
@@ -99,23 +99,23 @@ int avro_raw_map_get_or_create(avro_raw_
 	unsigned int  i;
 	int  is_new;
 
-	if (st_lookup(map->indices_by_key, (st_data_t) key, &data)) {
+	if (st_lookup((st_table *) map->indices_by_key, (st_data_t) key, &data)) {
 		i = (unsigned int) data;
 		void  *raw_entry =
-		    (map->elements.data + map->elements.element_size * i);
-		el = raw_entry + sizeof(avro_raw_map_entry_t);
+		    ((char *) map->elements.data + map->elements.element_size * i);
+		el = (char *) raw_entry + sizeof(avro_raw_map_entry_t);
 		is_new = 0;
 	} else {
 		i = map->elements.element_count;
 		avro_raw_map_entry_t  *raw_entry =
-		    avro_raw_array_append(&map->elements);
+		    (avro_raw_map_entry_t *) avro_raw_array_append(&map->elements);
 		raw_entry->key = avro_strdup(key);
-		st_insert(map->indices_by_key,
+		st_insert((st_table *) map->indices_by_key,
 			  (st_data_t) raw_entry->key, (st_data_t) i);
 		if (!raw_entry) {
 			return -ENOMEM;
 		}
-		el = ((void *) raw_entry) + sizeof(avro_raw_map_entry_t);
+		el = ((char *) raw_entry) + sizeof(avro_raw_map_entry_t);
 		is_new = 1;
 	}
 

Modified: avro/trunk/lang/c/src/memoize.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/memoize.c?rev=1331812&r1=1331811&r2=1331812&view=diff
==============================================================================
--- avro/trunk/lang/c/src/memoize.c (original)
+++ avro/trunk/lang/c/src/memoize.c Sat Apr 28 19:40:52 2012
@@ -52,8 +52,8 @@ avro_memoize_key_hash(avro_memoize_key_t
 
 
 static struct st_hash_type  avro_memoize_hash_type = {
-	avro_memoize_key_cmp,
-	avro_memoize_key_hash
+	HASH_FUNCTION_CAST avro_memoize_key_cmp,
+	HASH_FUNCTION_CAST avro_memoize_key_hash
 };
 
 
@@ -78,8 +78,8 @@ avro_memoize_free_key(avro_memoize_key_t
 void
 avro_memoize_done(avro_memoize_t *mem)
 {
-	st_foreach(mem->cache, avro_memoize_free_key, 0);
-	st_free_table(mem->cache);
+	st_foreach((st_table *) mem->cache, HASH_FUNCTION_CAST avro_memoize_free_key, 0);
+	st_free_table((st_table *) mem->cache);
 	memset(mem, 0, sizeof(avro_memoize_t));
 }
 
@@ -98,7 +98,7 @@ avro_memoize_get(avro_memoize_t *mem,
 		void  *value;
 	} val;
 
-	if (st_lookup(mem->cache, (st_data_t) &key, &val.data)) {
+	if (st_lookup((st_table *) mem->cache, (st_data_t) &key, &val.data)) {
 		if (result) {
 			*result = val.value;
 		}
@@ -129,8 +129,8 @@ avro_memoize_set(avro_memoize_t *mem,
 		void  *value;
 	} val;
 
-	if (st_lookup(mem->cache, (st_data_t) &key, &val.data)) {
-		st_insert(mem->cache, (st_data_t) &key, (st_data_t) result);
+	if (st_lookup((st_table *) mem->cache, (st_data_t) &key, &val.data)) {
+		st_insert((st_table *) mem->cache, (st_data_t) &key, (st_data_t) result);
 		return;
 	}
 
@@ -138,11 +138,11 @@ avro_memoize_set(avro_memoize_t *mem,
 	 * If it's a new key pair, then we do need to allocate.
 	 */
 
-	avro_memoize_key_t  *real_key = avro_new(avro_memoize_key_t);
+	avro_memoize_key_t  *real_key = (avro_memoize_key_t *) avro_new(avro_memoize_key_t);
 	real_key->key1 = key1;
 	real_key->key2 = key2;
 
-	st_insert(mem->cache, (st_data_t) real_key, (st_data_t) result);
+	st_insert((st_table *) mem->cache, (st_data_t) real_key, (st_data_t) result);
 }
 
 
@@ -159,7 +159,7 @@ avro_memoize_delete(avro_memoize_t *mem,
 	} real_key;
 
 	real_key.key = &key;
-	if (st_delete(mem->cache, &real_key.data, NULL)) {
+	if (st_delete((st_table *) mem->cache, &real_key.data, NULL)) {
 		avro_freet(avro_memoize_key_t, real_key.key);
 	}
 }



Mime
View raw message