aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/data-create.c
diff options
context:
space:
mode:
authorLeo Howell <leo@lwh.jp>2009-09-27 16:53:16 +0900
committerLeo Howell <leo@lwh.jp>2009-09-27 16:53:16 +0900
commit388507a61df32c0bddf7e61c5da013c3f29d32d4 (patch)
tree3319b13ff5c0cb8398393519c8c531599735b5f4 /lpg/libqr/data-create.c
parent559eb9633e1f97d70112f02538ae5e9a0e46f4d5 (diff)
downloadpdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.tar.gz
pdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.tar.xz
pdf-simple-sign-388507a61df32c0bddf7e61c5da013c3f29d32d4.zip
bitstream -> qr_bitstream
Diffstat (limited to 'lpg/libqr/data-create.c')
-rw-r--r--lpg/libqr/data-create.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/lpg/libqr/data-create.c b/lpg/libqr/data-create.c
index 2910997..a918413 100644
--- a/lpg/libqr/data-create.c
+++ b/lpg/libqr/data-create.c
@@ -9,15 +9,15 @@
#include <stdlib.h>
#include <qr/data.h>
-#include "bitstream.h"
+#include "qr-bitstream.h"
#include "data-common.h"
static void write_type_and_length(struct qr_data * data,
enum qr_data_type type,
size_t length)
{
- (void)bitstream_write(data->bits, QR_TYPE_CODES[type], 4);
- (void)bitstream_write(data->bits, length,
+ (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));
}
@@ -25,7 +25,7 @@ static struct qr_data * encode_numeric(struct qr_data * data,
const char * input,
size_t length)
{
- struct bitstream * stream = data->bits;
+ struct qr_bitstream * stream = data->bits;
size_t bits;
bits = 4 + get_size_field_length(data->format, QR_DATA_NUMERIC)
@@ -37,8 +37,8 @@ static struct qr_data * encode_numeric(struct qr_data * data,
bits += 7;
stream = data->bits;
- if (bitstream_resize(stream,
- bitstream_size(stream) + bits) != 0)
+ if (qr_bitstream_resize(stream,
+ qr_bitstream_size(stream) + bits) != 0)
return 0;
write_type_and_length(data, QR_DATA_NUMERIC, length);
@@ -54,7 +54,7 @@ static struct qr_data * encode_numeric(struct qr_data * data,
x = (input[0] - '0') * 100
+ (input[1] - '0') * 10
+ (input[2] - '0');
- bitstream_write(stream, x, 10);
+ qr_bitstream_write(stream, x, 10);
input += 3;
}
@@ -72,7 +72,7 @@ static struct qr_data * encode_numeric(struct qr_data * data,
x = x * 10 + (*input - '0');
}
- bitstream_write(stream, x, length == 2 ? 7 : 4);
+ qr_bitstream_write(stream, x, length == 2 ? 7 : 4);
}
return data;
@@ -103,7 +103,7 @@ static struct qr_data * encode_alpha(struct qr_data * data,
const char * input,
size_t length)
{
- struct bitstream * stream = data->bits;
+ struct qr_bitstream * stream = data->bits;
size_t bits;
bits = 4 + get_size_field_length(data->format, QR_DATA_ALPHA)
@@ -111,8 +111,8 @@ static struct qr_data * encode_alpha(struct qr_data * data,
+ 6 * (length % 2);
stream = data->bits;
- if (bitstream_resize(stream,
- bitstream_size(stream) + bits) != 0)
+ if (qr_bitstream_resize(stream,
+ qr_bitstream_size(stream) + bits) != 0)
return 0;
write_type_and_length(data, QR_DATA_ALPHA, length);
@@ -128,7 +128,7 @@ static struct qr_data * encode_alpha(struct qr_data * data,
return 0;
x = c1 * 45 + c2;
- bitstream_write(stream, x, 11);
+ qr_bitstream_write(stream, x, 11);
}
if (length > 0) {
@@ -137,7 +137,7 @@ static struct qr_data * encode_alpha(struct qr_data * data,
if (c < 0)
return 0;
- bitstream_write(stream, c, 6);
+ qr_bitstream_write(stream, c, 6);
}
return data;
@@ -147,21 +147,21 @@ static struct qr_data * encode_8bit(struct qr_data * data,
const char * input,
size_t length)
{
- struct bitstream * stream = data->bits;
+ struct qr_bitstream * stream = data->bits;
size_t bits;
bits = 4 + get_size_field_length(data->format, QR_DATA_8BIT)
+ 8 * length;
stream = data->bits;
- if (bitstream_resize(stream,
- bitstream_size(stream) + bits) != 0)
+ if (qr_bitstream_resize(stream,
+ qr_bitstream_size(stream) + bits) != 0)
return 0;
write_type_and_length(data, QR_DATA_8BIT, length);
while (length--)
- bitstream_write(stream, *input++, 8);
+ qr_bitstream_write(stream, *input++, 8);
return data;
}
@@ -188,7 +188,7 @@ struct qr_data * qr_create_data(int format,
return 0;
data->format = format;
- data->bits = bitstream_create();
+ data->bits = qr_bitstream_create();
data->offset = 0;
if (data->bits) {
@@ -210,7 +210,7 @@ struct qr_data * qr_create_data(int format,
}
if (!ret) {
- bitstream_destroy(data->bits);
+ qr_bitstream_destroy(data->bits);
free(data);
}