Make it compile with all of the warnings on
diff --git a/Makefile b/Makefile
index f336269..da89b3d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 # enable this for iphone builds
 #CFLAGS = -I /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include -arch armv7 -Os
+CFLAGS = -Wall -Wextra -Wno-unknown-pragmas -Werror-implicit-function-declaration -Werror -Wno-unused-parameter -Wdeclaration-after-statement -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
 
 all: cntest
 
@@ -8,7 +9,7 @@
 	-diff new.out expected.out
 
 cntest: test.c cbor.h cn-cbor.h cn-cbor.c
-	clang cn-cbor.c test.c -o cntest
+	clang $(CFLAGS) cn-cbor.c test.c -o cntest
 
 size: cn-cbor.o
 	size cn-cbor.o
diff --git a/cn-cbor.c b/cn-cbor.c
index 9e3e814..23448cd 100644
--- a/cn-cbor.c
+++ b/cn-cbor.c
@@ -75,8 +75,8 @@
 };
 
 #define TAKE(pos, ebuf, n, stmt)                \
-  if (n > (ebuf - pos))                         \
-    CN_CBOR_FAIL(CN_CBOR_ERR_OUT_OF_DATA);                \
+  if (n > (unsigned)(ebuf - pos))                         \
+    CN_CBOR_FAIL(CN_CBOR_ERR_OUT_OF_DATA);      \
   stmt;                                         \
   pos += n;
 
@@ -119,10 +119,6 @@
   parent->last_child = cb;
   parent->length++;
 
-  cn_cbor *it;
-  cn_cbor *it2;
-  uint64_t i;
-
   switch (ai) {
   case AI_1: TAKE(pos, ebuf, 1, val = ntoh8p(pos)) ; break;
   case AI_2: TAKE(pos, ebuf, 2, val = ntoh16p(pos)) ; break;
@@ -220,8 +216,8 @@
 }
 
 const cn_cbor* cn_cbor_decode(const char* buf, size_t len, cn_cbor_errback *errp) {
-  cn_cbor catcher = {CN_CBOR_INVALID};
-  struct parse_buf pb = {(unsigned char *)buf, (unsigned char *)buf+len};
+  cn_cbor catcher = {CN_CBOR_INVALID, 0, {0}, 0, 0, 0, 0, 0};
+  struct parse_buf pb = {(unsigned char *)buf, (unsigned char *)buf+len, CN_CBOR_NO_ERROR};
   cn_cbor* ret = decode_item(&pb, &catcher);
   if (ret) {
     ret->parent = 0;            /* mark as top node */
@@ -230,7 +226,7 @@
       catcher.first_child->parent = 0;
       cn_cbor_free(catcher.first_child);
     }
-  fail:
+  //fail:
     if (errp) {
       errp->err = pb.err;
       errp->pos = pb.buf - (unsigned char *)buf;
diff --git a/test.c b/test.c
index 0d8acab..a59c847 100644
--- a/test.c
+++ b/test.c
@@ -80,7 +80,7 @@
 }
 
 
-char *err_name[] = {
+const char *err_name[] = {
   "CN_CBOR_NO_ERROR",
   "CN_CBOR_ERR_OUT_OF_DATA",
   "CN_CBOR_ERR_NOT_ALL_DATA_CONSUMED",
@@ -92,7 +92,7 @@
   "CN_CBOR_ERR_OUT_OF_MEMORY",
 };
 
-void cn_cbor_decode_test(char *buf, int len) {
+static void cn_cbor_decode_test(const char *buf, int len) {
   struct cn_cbor_errback back;
   const cn_cbor *ret = cn_cbor_decode(buf, len, &back);
   if (ret)