changeset 6:be345cbc031f

Remove byte typedef from jason.h, to avoid conflicting with any caller's definition of this
author Norman Gray <norman@astro.gla.ac.uk>
date Sat, 07 Sep 2013 19:15:44 +0100
parents e4da36a2abae
children 0fe69732bc90
files README.md src/jason.h src/test/unit_tests.c src/util.h
diffstat 4 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Fri Sep 06 19:00:17 2013 +0100
+++ b/README.md	Sat Sep 07 19:15:44 2013 +0100
@@ -74,17 +74,17 @@
 Serialise the object to a string.  The string must be subsequently
 freed by the caller.
 
-    byte* get_der_encoding(JsonObject obj, size_t *len);
+    uint8_t* get_der_encoding(JsonObject obj, size_t *len);
 
 Get the DER-encoding of the object.  The object must not be freed by
 the caller.
 
-    char* bytes_to_string(byte* b, size_t blen);
+    char* bytes_to_string(uint8_t* b, size_t blen);
 
 Utility method to serialise a byte sequence to a printable string of
 hex digits.  The returned object must be freed by the caller.
 
-    JsonObject parse_der_bytes(byte*, size_t, size_t*);
+    JsonObject parse_der_bytes(uint8_t*, size_t, size_t*);
 
 Decode a sequence of bytes which are the DER encoding of a JSON
 object, and return the object.  If the byte sequence
--- a/src/jason.h	Fri Sep 06 19:00:17 2013 +0100
+++ b/src/jason.h	Sat Sep 07 19:15:44 2013 +0100
@@ -5,7 +5,6 @@
 
 #include <inttypes.h> /* includes stdint.h */
 
-typedef uint8_t byte;
 
 typedef intmax_t jsonint;
 #define JSONFMT PRIiMAX
@@ -23,7 +22,7 @@
 
 struct json_object {
     JsonType type;
-    byte* der_encoding;
+    uint8_t* der_encoding;
     size_t der_encoding_length;
     union {
         const char* s;
@@ -51,10 +50,10 @@
 JsonObject initialise_json_object(JsonObject, JsonType);
 void free_json_object(JsonObject o);
 const char* print_json_object(JsonObject obj);
-byte* get_der_encoding(JsonObject obj, size_t *len);
-char* bytes_to_string(byte* b, size_t blen);
+uint8_t* get_der_encoding(JsonObject obj, size_t *len);
+char* bytes_to_string(uint8_t* b, size_t blen);
 JsonObject parse_json_string(const char* json_string);
-JsonObject parse_der_bytes(byte*, size_t, size_t*);
+JsonObject parse_der_bytes(uint8_t*, size_t, size_t*);
 const char* unsupported_message();
 
 const char* jason_version_string();
--- a/src/test/unit_tests.c	Fri Sep 06 19:00:17 2013 +0100
+++ b/src/test/unit_tests.c	Sat Sep 07 19:15:44 2013 +0100
@@ -2,6 +2,8 @@
 #include "../jason.h"
 #include "lcut/lcut.h"
 
+#define byte uint8_t
+
 
 void tc_basic_json_parse(lcut_tc_t *tc, void *data)
 {
--- a/src/util.h	Fri Sep 06 19:00:17 2013 +0100
+++ b/src/util.h	Sat Sep 07 19:15:44 2013 +0100
@@ -2,6 +2,7 @@
 #define UTIL_H 1
 
 #include "jason.h"
+typedef uint8_t byte;
 
 #if 0
 /**