Merge branch 'master' of https://github.com/cabo/cn-cbor

# By Carsten Bormann (1) and Joe Hildebrand (1)
# Via Carsten Bormann
* 'master' of https://github.com/cabo/cn-cbor:
  Add MIT LICENSE file
  Remove remnant that is no longer true from README
diff --git a/Makefile b/Makefile
index 1752a6d..40c5ee1 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
 	env MallocStackLogging=true ./cntest >new.out
 	-diff new.out expected.out
 
-cntest: test.c cbor.h cn-cbor.h cn-cbor.c cn-manip.c
+cntest: cbor.h cn-cbor.h cn-cbor.c cn-error.c cn-manip.c test.c 
 	clang $(CFLAGS) cn-cbor.c cn-error.c cn-manip.c test.c -o cntest
 
 size: cn-cbor.o
diff --git a/cn-cbor.c b/cn-cbor.c
index e0fd53b..6336ee4 100644
--- a/cn-cbor.c
+++ b/cn-cbor.c
@@ -14,8 +14,6 @@
 #include <assert.h>
 #include <math.h>
 
-#include <arpa/inet.h>
-
 #include "cn-cbor.h"
 #include "cbor.h"
 
@@ -91,7 +89,7 @@
   unsigned int mt;
   int ai;
   uint64_t val;
-  cn_cbor* cb = NULL;
+  cn_cbor* cb;
   union {
     float f;
     uint32_t u;
@@ -236,6 +234,7 @@
       catcher.first_child->parent = 0;
       cn_cbor_free(catcher.first_child);
     }
+  //fail:
     if (errp) {
       errp->err = pb.err;
       errp->pos = pb.buf - (unsigned char *)buf;
diff --git a/cn-cbor.h b/cn-cbor.h
index 7764190..2bf9416 100644
--- a/cn-cbor.h
+++ b/cn-cbor.h
@@ -65,7 +65,7 @@
 const cn_cbor* cn_cbor_decode(const char* buf, size_t len, cn_cbor_errback *errp);
 const cn_cbor* cn_cbor_mapget_string(const cn_cbor* cb, const char* key);
 const cn_cbor* cn_cbor_mapget_int(const cn_cbor* cb, int key);
-const cn_cbor* cn_cbor_index(const cn_cbor* cb, int idx);
+const cn_cbor* cn_cbor_index(const cn_cbor* cb, unsigned int idx);
 
 const cn_cbor* cn_cbor_alloc(cn_cbor_type t);
 void cn_cbor_free(const cn_cbor* js);
diff --git a/cn-manip.c b/cn-manip.c
index 4f91c45..130ab97 100644
--- a/cn-manip.c
+++ b/cn-manip.c
@@ -33,14 +33,7 @@
   keylen = strlen(key);
   for (cp = cb->first_child; cp && cp->next; cp = cp->next->next) {
     switch(cp->type) {
-    case CN_CBOR_TEXT:
-      if (keylen != cp->length) {
-        continue;
-      }
-      if (strncmp(key, cp->v.str, cp->length) == 0) {
-        return cp->next;
-      }
-      break;
+    case CN_CBOR_TEXT: // fall through
     case CN_CBOR_BYTES:
       if (keylen != cp->length) {
         continue;
@@ -55,9 +48,9 @@
   return NULL;
 }
 
-const cn_cbor* cn_cbor_index(const cn_cbor* cb, int idx) {
+const cn_cbor* cn_cbor_index(const cn_cbor* cb, unsigned int idx) {
   cn_cbor *cp;
-  int i = 0;
+  unsigned int i = 0;
   assert(cb);
   for (cp = cb->first_child; cp; cp = cp->next) {
     if (i == idx) {