diff options
author | Leo Howell <leo@lwh.jp> | 2009-10-08 14:38:37 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-10-08 14:38:37 +0900 |
commit | 62e8a6f2ad89be06c7e649c0fc4c564ecad2d070 (patch) | |
tree | a870eb56ba9c02e5807d3ce3d556bca98c1f2e8c /lpg/libqr/data-create.c | |
parent | ad59de83b7f82cb812d23ac2bb948ac32fe0ac71 (diff) | |
download | pdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.tar.gz pdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.tar.xz pdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.zip |
code format --> version
Diffstat (limited to 'lpg/libqr/data-create.c')
-rw-r--r-- | lpg/libqr/data-create.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lpg/libqr/data-create.c b/lpg/libqr/data-create.c index a918413..2c2737f 100644 --- a/lpg/libqr/data-create.c +++ b/lpg/libqr/data-create.c @@ -18,7 +18,7 @@ static void write_type_and_length(struct qr_data * data, { (void)qr_bitstream_write(data->bits, QR_TYPE_CODES[type], 4); (void)qr_bitstream_write(data->bits, length, - get_size_field_length(data->format, type)); + get_size_field_length(data->version, type)); } static struct qr_data * encode_numeric(struct qr_data * data, @@ -28,7 +28,7 @@ static struct qr_data * encode_numeric(struct qr_data * data, struct qr_bitstream * stream = data->bits; size_t bits; - bits = 4 + get_size_field_length(data->format, QR_DATA_NUMERIC) + bits = 4 + get_size_field_length(data->version, QR_DATA_NUMERIC) + 10 * (length / 3); if (length % 3 == 1) @@ -106,7 +106,7 @@ static struct qr_data * encode_alpha(struct qr_data * data, struct qr_bitstream * stream = data->bits; size_t bits; - bits = 4 + get_size_field_length(data->format, QR_DATA_ALPHA) + bits = 4 + get_size_field_length(data->version, QR_DATA_ALPHA) + 11 * (length / 2) + 6 * (length % 2); @@ -150,7 +150,7 @@ static struct qr_data * encode_8bit(struct qr_data * data, struct qr_bitstream * stream = data->bits; size_t bits; - bits = 4 + get_size_field_length(data->format, QR_DATA_8BIT) + bits = 4 + get_size_field_length(data->version, QR_DATA_8BIT) + 8 * length; stream = data->bits; @@ -173,21 +173,21 @@ static struct qr_data * encode_kanji(struct qr_data * data, return 0; } -struct qr_data * qr_create_data(int format, +struct qr_data * qr_create_data(int version, enum qr_data_type type, const char * input, size_t length) { struct qr_data * data; - if (format < 1 || format > 40) + if (version < 1 || version > 40) return 0; data = malloc(sizeof(*data)); if (!data) return 0; - data->format = format; + data->version = version; data->bits = qr_bitstream_create(); data->offset = 0; |