Merge pull request #11 from kAworu/display-human-readable-data-type

dump_data: display a human readable Data type.
This commit is contained in:
Daniel Beer 2016-07-20 08:24:06 +12:00 committed by GitHub
commit d968f0ae33

View file

@ -21,14 +21,24 @@
#include <jpeglib.h>
#include <png.h>
#include <quirc.h>
#include "dbgutil.h"
void dump_data(const struct quirc_data *data)
{
static const char *data_type_str[] = {
[QUIRC_DATA_TYPE_NUMERIC] = "NUMERIC",
[QUIRC_DATA_TYPE_ALPHA] = "ALPHANUMERIC",
[QUIRC_DATA_TYPE_BYTE] = "BINARY",
[QUIRC_DATA_TYPE_KANJI] = "KANJI",
};
printf(" Version: %d\n", data->version);
printf(" ECC level: %c\n", "MLHQ"[data->ecc_level]);
printf(" Mask: %d\n", data->mask);
printf(" Data type: %d\n", data->data_type);
printf(" Data type: %d (%s)\n",
data->data_type, data_type_str[data->data_type]);
printf(" Length: %d\n", data->payload_len);
printf(" Payload: %s\n", data->payload);
}