remove int16, use int8 as bool instead of integer
[project/libubox.git] / blobmsg_json.c
index 6a6014b..eae2ac8 100644 (file)
@@ -204,16 +204,13 @@ static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, boo
        data_str = buf;
        switch(blob_id(attr)) {
        case BLOBMSG_TYPE_INT8:
        data_str = buf;
        switch(blob_id(attr)) {
        case BLOBMSG_TYPE_INT8:
-               sprintf(buf, "%d", *(uint8_t *)data);
-               break;
-       case BLOBMSG_TYPE_INT16:
-               sprintf(buf, "%d", *(uint16_t *)data);
+               sprintf(buf, "%s", *(uint8_t *)data ? "true" : "false");
                break;
        case BLOBMSG_TYPE_INT32:
                sprintf(buf, "%d", *(uint32_t *)data);
                break;
        case BLOBMSG_TYPE_INT64:
                break;
        case BLOBMSG_TYPE_INT32:
                sprintf(buf, "%d", *(uint32_t *)data);
                break;
        case BLOBMSG_TYPE_INT64:
-               sprintf(buf, "%lld", *(uint64_t *)data);
+               sprintf(buf, "%lld", (long long int) *(uint64_t *)data);
                break;
        case BLOBMSG_TYPE_STRING:
                blobmsg_format_string(s, data);
                break;
        case BLOBMSG_TYPE_STRING:
                blobmsg_format_string(s, data);