From c2e4639d2ebefbeb7f8b7e1826ae2391c6876a5a Mon Sep 17 00:00:00 2001 From: Leo Howell Date: Sat, 14 Nov 2009 20:24:57 +0900 Subject: Merge some files --- lpg/libqr/qr/bitstream.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lpg/libqr/qr/bitstream.h (limited to 'lpg/libqr/qr/bitstream.h') diff --git a/lpg/libqr/qr/bitstream.h b/lpg/libqr/qr/bitstream.h new file mode 100644 index 0000000..cf20694 --- /dev/null +++ b/lpg/libqr/qr/bitstream.h @@ -0,0 +1,48 @@ +#ifndef QR_BITSTREAM_H +#define QR_BITSTREAM_H + +#include + +/** + * Note: when writing / reading multiple bits, the + * _most_ significant bits come first in the stream. + * (That is, the order you would naturally write the + * number in binary) + */ + +struct qr_bitstream; + +struct qr_bitstream * qr_bitstream_create(void); +int qr_bitstream_resize(struct qr_bitstream *, size_t bits); +void qr_bitstream_destroy(struct qr_bitstream *); +struct qr_bitstream * qr_bitstream_dup(const struct qr_bitstream *); + +void qr_bitstream_seek(struct qr_bitstream *, size_t pos); +size_t qr_bitstream_tell(const struct qr_bitstream *); +size_t qr_bitstream_remaining(const struct qr_bitstream *); +size_t qr_bitstream_size(const struct qr_bitstream *); + +unsigned int qr_bitstream_read(struct qr_bitstream *, size_t bits); + +void qr_bitstream_unpack(struct qr_bitstream *, + unsigned int * result, + size_t count, + size_t bitsize); + +int qr_bitstream_write(struct qr_bitstream *, + unsigned int value, + size_t bits); + +int qr_bitstream_pack(struct qr_bitstream *, + const unsigned int * values, + size_t count, + size_t bitsize); + +int qr_bitstream_cat(struct qr_bitstream *, const struct qr_bitstream * src); + +int qr_bitstream_copy(struct qr_bitstream * dest, + struct qr_bitstream * src, + size_t count); + +#endif + -- cgit v1.2.3-70-g09d2 From 5d91255e986b6f1fb6205cc759ff5d43ccb3c96f Mon Sep 17 00:00:00 2001 From: Leo Howell Date: Sat, 14 Nov 2009 20:31:08 +0900 Subject: Final tidy for 0.1 --- lpg/libqr/COPYING | 16 +++++++--------- lpg/libqr/TODO | 9 --------- lpg/libqr/code-common.c | 2 +- lpg/libqr/galois.c | 7 +++---- lpg/libqr/galois.h | 7 +++---- lpg/libqr/qr/bitstream.h | 23 ++++++++++++----------- 6 files changed, 26 insertions(+), 38 deletions(-) (limited to 'lpg/libqr/qr/bitstream.h') diff --git a/lpg/libqr/COPYING b/lpg/libqr/COPYING index 10a9711..ff2f585 100644 --- a/lpg/libqr/COPYING +++ b/lpg/libqr/COPYING @@ -1,16 +1,14 @@ -I, the author, hereby release this work into the public -domain. +I, the author, hereby release this work into the public domain. -Where the above is not possible, I release this work as -"Copyright-Free", or (at your option) under the terms of -the Creative Commons CC0 license: +Where the above is not possible, I release this work as "Copyright +Free", or (at your option) under the terms of the Creative Commons CC0 +license: http://creativecommons.org/publicdomain/zero/1.0/ -The author waives all rights concerning the modification, -reproduction and/or distribution of this work, or -derivatives thereof, in whole or part, and in any form. -Attribution is not required. +The author waives all rights concerning the modification, reproduction +and/or distribution of this work, or derivatives thereof, in whole or +in part, and in any form. Attribution is not required. Leo Howell, September 2009 diff --git a/lpg/libqr/TODO b/lpg/libqr/TODO index 3cd0583..1b9671b 100644 --- a/lpg/libqr/TODO +++ b/lpg/libqr/TODO @@ -1,20 +1,11 @@ -* Fix XXX, TODO -* Tidy code -* RELEASE v0.1 - * Parsing -* RELEASE v0.2 * Detection -* RELEASE v0.3 * Test suite * No-malloc * Optimize * Documentation -* RELEASE v0.4 (BETA) - -* RELEASE v1.0 * Other data types diff --git a/lpg/libqr/code-common.c b/lpg/libqr/code-common.c index bc6621a..a0b8fcc 100644 --- a/lpg/libqr/code-common.c +++ b/lpg/libqr/code-common.c @@ -47,7 +47,7 @@ struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig, struct qr_bitmap * bmp; int i, j; - if (mask & ~0x7) + if (mask > 7) return 0; bmp = qr_bitmap_clone(orig); diff --git a/lpg/libqr/galois.c b/lpg/libqr/galois.c index e21ce22..f0aadfd 100644 --- a/lpg/libqr/galois.c +++ b/lpg/libqr/galois.c @@ -5,8 +5,7 @@ #include "galois.h" /* Calculate the residue of a modulo m */ -unsigned long gf_residue(unsigned long a, - unsigned long m) +unsigned long gf_residue(unsigned long a, unsigned long m) { unsigned long o = 1; int n = 1; @@ -77,8 +76,8 @@ static unsigned int * make_generator(int k) } struct qr_bitstream * rs_generate_words(struct qr_bitstream * data, - size_t data_words, - size_t rs_words) + size_t data_words, + size_t rs_words) { struct qr_bitstream * ec = 0; unsigned int * b = 0; diff --git a/lpg/libqr/galois.h b/lpg/libqr/galois.h index 1adeb88..4ca0c93 100644 --- a/lpg/libqr/galois.h +++ b/lpg/libqr/galois.h @@ -1,12 +1,11 @@ #ifndef QR_GALOIS_H #define QR_GALOIS_H -unsigned long gf_residue(unsigned long a, - unsigned long m); +unsigned long gf_residue(unsigned long a, unsigned long m); struct qr_bitstream * rs_generate_words(struct qr_bitstream * data, - size_t data_words, - size_t rs_words); + size_t data_words, + size_t rs_words); #endif diff --git a/lpg/libqr/qr/bitstream.h b/lpg/libqr/qr/bitstream.h index cf20694..5ca6b41 100644 --- a/lpg/libqr/qr/bitstream.h +++ b/lpg/libqr/qr/bitstream.h @@ -13,8 +13,8 @@ struct qr_bitstream; struct qr_bitstream * qr_bitstream_create(void); -int qr_bitstream_resize(struct qr_bitstream *, size_t bits); -void qr_bitstream_destroy(struct qr_bitstream *); +int qr_bitstream_resize(struct qr_bitstream *, size_t bits); +void qr_bitstream_destroy(struct qr_bitstream *); struct qr_bitstream * qr_bitstream_dup(const struct qr_bitstream *); void qr_bitstream_seek(struct qr_bitstream *, size_t pos); @@ -25,20 +25,21 @@ size_t qr_bitstream_size(const struct qr_bitstream *); unsigned int qr_bitstream_read(struct qr_bitstream *, size_t bits); void qr_bitstream_unpack(struct qr_bitstream *, - unsigned int * result, - size_t count, - size_t bitsize); + unsigned int * result, + size_t count, + size_t bitsize); int qr_bitstream_write(struct qr_bitstream *, - unsigned int value, - size_t bits); + unsigned int value, + size_t bits); int qr_bitstream_pack(struct qr_bitstream *, - const unsigned int * values, - size_t count, - size_t bitsize); + const unsigned int * values, + size_t count, + size_t bitsize); -int qr_bitstream_cat(struct qr_bitstream *, const struct qr_bitstream * src); +int qr_bitstream_cat(struct qr_bitstream *, + const struct qr_bitstream * src); int qr_bitstream_copy(struct qr_bitstream * dest, struct qr_bitstream * src, -- cgit v1.2.3-70-g09d2 From d4abb878df167875bb66d1e0debe853cb6b88b1b Mon Sep 17 00:00:00 2001 From: Leo Uino Date: Tue, 19 Jul 2011 12:04:15 +0900 Subject: Fix some types --- lpg/libqr/bitmap.c | 6 +++--- lpg/libqr/bitstream.c | 14 +++++++------- lpg/libqr/code-common.c | 2 +- lpg/libqr/code-create.c | 16 +++++++++------- lpg/libqr/code-layout.c | 6 +++--- lpg/libqr/code-parse.c | 4 ++-- lpg/libqr/constants.h | 2 +- lpg/libqr/data-create.c | 2 +- lpg/libqr/galois.c | 2 +- lpg/libqr/qr/bitmap.h | 6 +++--- lpg/libqr/qr/bitstream.h | 10 +++++----- lpg/libqr/qr/parse.h | 2 +- lpg/libqr/qrgen.c | 2 +- 13 files changed, 38 insertions(+), 36 deletions(-) (limited to 'lpg/libqr/qr/bitstream.h') diff --git a/lpg/libqr/bitmap.c b/lpg/libqr/bitmap.c index 759aeca..b9d3763 100644 --- a/lpg/libqr/bitmap.c +++ b/lpg/libqr/bitmap.c @@ -5,7 +5,7 @@ #include -struct qr_bitmap * qr_bitmap_create(int width, int height, int masked) +struct qr_bitmap * qr_bitmap_create(size_t width, size_t height, int masked) { struct qr_bitmap * out; size_t size; @@ -169,9 +169,9 @@ static void render_line_2(unsigned char * out, void qr_bitmap_render(const struct qr_bitmap * bmp, void * buffer, - size_t mod_bits, + int mod_bits, size_t line_stride, - size_t line_repeat, + int line_repeat, unsigned long mark, unsigned long space) { diff --git a/lpg/libqr/bitstream.c b/lpg/libqr/bitstream.c index cf5a9d4..cc8a1ae 100644 --- a/lpg/libqr/bitstream.c +++ b/lpg/libqr/bitstream.c @@ -121,13 +121,13 @@ size_t qr_bitstream_size(const struct qr_bitstream * stream) return stream->count; } -unsigned int qr_bitstream_read(struct qr_bitstream * stream, size_t bits) +unsigned long qr_bitstream_read(struct qr_bitstream * stream, int bits) { - unsigned int result = 0; + unsigned long result = 0; unsigned char * byte; size_t bitnum; - assert(qr_bitstream_remaining(stream) >= bits); + assert(qr_bitstream_remaining(stream) >= (size_t) bits); byte = stream->buffer + (stream->pos / CHAR_BIT); bitnum = stream->pos % CHAR_BIT; @@ -149,7 +149,7 @@ unsigned int qr_bitstream_read(struct qr_bitstream * stream, size_t bits) void qr_bitstream_unpack(struct qr_bitstream * stream, unsigned int * result, size_t count, - size_t bitsize) + int bitsize) { assert(qr_bitstream_remaining(stream) >= (count * bitsize)); @@ -158,8 +158,8 @@ void qr_bitstream_unpack(struct qr_bitstream * stream, } int qr_bitstream_write(struct qr_bitstream * stream, - unsigned int value, - size_t bits) + unsigned long value, + int bits) { unsigned char * byte; size_t bitnum; @@ -189,7 +189,7 @@ int qr_bitstream_write(struct qr_bitstream * stream, int qr_bitstream_pack(struct qr_bitstream * stream, const unsigned int * values, size_t count, - size_t bitsize) + int bitsize) { if (ensure_available(stream, count * bitsize) != 0) return -1; diff --git a/lpg/libqr/code-common.c b/lpg/libqr/code-common.c index 1cb1745..babaf86 100644 --- a/lpg/libqr/code-common.c +++ b/lpg/libqr/code-common.c @@ -76,7 +76,7 @@ void qr_get_rs_block_sizes(int version, void qr_mask_apply(struct qr_bitmap * bmp, int mask) { - int i, j; + size_t i, j; assert((mask & 0x7) == mask); mask &= 0x7; diff --git a/lpg/libqr/code-create.c b/lpg/libqr/code-create.c index cf04eb7..f9d86a7 100644 --- a/lpg/libqr/code-create.c +++ b/lpg/libqr/code-create.c @@ -36,7 +36,7 @@ static void x_dump(struct qr_bitstream * bits) qr_bitstream_seek(bits, 0); n = qr_bitstream_size(bits); for (i = 0; i < n; ++i) { - fprintf(stderr, "%d", qr_bitstream_read(bits, 1)); + fprintf(stderr, "%d", (int) qr_bitstream_read(bits, 1)); if (i % 8 == 7) fputc(' ', stderr); if ((i+1) % (7 * 8) == 0) @@ -173,7 +173,7 @@ static struct qr_bitstream * make_data(int version, const size_t total_data = QR_DATA_WORD_COUNT[version - 1][ec ^ 0x1]; int block_count[2], data_length[2], ec_length[2]; int total_blocks; - size_t i, w; + int i, w; struct qr_bitstream * dcopy = 0; struct qr_bitstream * out = 0; struct qr_bitstream ** blocks = 0; @@ -296,7 +296,7 @@ struct qr_code * qr_code_create(const struct qr_data * data) goto fail; qr_bitstream_seek(bits, 0); - while (qr_bitstream_remaining(bits) >= QR_WORD_BITS) + while (qr_bitstream_remaining(bits) >= (size_t) QR_WORD_BITS) qr_layout_write(layout, qr_bitstream_read(bits, QR_WORD_BITS)); qr_layout_end(layout); @@ -370,7 +370,8 @@ static int score_mask(const struct qr_bitmap * bmp) static int score_runs(const struct qr_bitmap * bmp, int base) { /* Runs of 5+n bits -> N[0] + i */ - int x, y, flip; + size_t x, y; + int flip; int score = 0; int count, last; @@ -406,7 +407,7 @@ static int score_runs(const struct qr_bitmap * bmp, int base) static int count_2blocks(const struct qr_bitmap * bmp) { /* Count the number of 2x2 blocks (on or off) */ - int x, y; + size_t x, y; int count = 0; /* Slow and stupid */ @@ -435,7 +436,8 @@ static int count_2blocks(const struct qr_bitmap * bmp) static int count_locators(const struct qr_bitmap * bmp) { /* 1:1:3:1:1 patterns -> N[2] */ - int x, y, flip; + size_t x, y; + int flip; int count = 0; for (flip = 0; flip <= 1; ++flip) { @@ -469,7 +471,7 @@ static int count_locators(const struct qr_bitmap * bmp) static int calc_bw_balance(const struct qr_bitmap * bmp) { /* Calculate the proportion (in percent) of "on" bits */ - int x, y; + size_t x, y; unsigned char bit; long on, total; diff --git a/lpg/libqr/code-layout.c b/lpg/libqr/code-layout.c index 8b4522d..fe8caa7 100644 --- a/lpg/libqr/code-layout.c +++ b/lpg/libqr/code-layout.c @@ -21,11 +21,11 @@ struct qr_iterator { void qr_layout_init_mask(struct qr_code * code) { - int x, y; - int dim = qr_code_width(code); + size_t x, y; + size_t dim = qr_code_width(code); struct qr_bitmap * bmp = code->modules; const int * am_pos = QR_ALIGNMENT_LOCATION[code->version - 1]; - int am_side; + size_t am_side; if (!bmp->mask) qr_bitmap_add_mask(bmp); diff --git a/lpg/libqr/code-parse.c b/lpg/libqr/code-parse.c index d4a2538..3fca4b2 100644 --- a/lpg/libqr/code-parse.c +++ b/lpg/libqr/code-parse.c @@ -111,7 +111,7 @@ static int read_bits(const struct qr_code * code, const size_t total_words = total_bits / QR_WORD_BITS; struct qr_bitstream * raw_bits; struct qr_iterator * layout; - int w; + size_t w; int ret = -1; raw_bits = qr_bitstream_create(); @@ -292,7 +292,7 @@ cleanup: return status; } -int qr_decode_format(unsigned bits, enum qr_ec_level * ec, int * mask) +int qr_decode_format(unsigned long bits, enum qr_ec_level * ec, int * mask) { bits ^= QR_FORMAT_MASK; diff --git a/lpg/libqr/constants.h b/lpg/libqr/constants.h index c13ae5a..b1f7493 100644 --- a/lpg/libqr/constants.h +++ b/lpg/libqr/constants.h @@ -17,7 +17,7 @@ static const unsigned int QR_FORMAT_POLY = 0x537; static const unsigned int QR_VERSION_POLY = 0x1F25; /* A QR-code word is always 8 bits, but CHAR_BIT might not be */ -static const unsigned int QR_WORD_BITS = 8; +static const int QR_WORD_BITS = 8; extern const int QR_ALIGNMENT_LOCATION[40][7]; extern const int QR_DATA_WORD_COUNT[40][4]; diff --git a/lpg/libqr/data-create.c b/lpg/libqr/data-create.c index 9d6c384..6437bc1 100644 --- a/lpg/libqr/data-create.c +++ b/lpg/libqr/data-create.c @@ -175,7 +175,7 @@ static int calc_min_version(enum qr_data_type type, for (version = 1; version <= 40; ++version) { if (4 + dbits + qr_data_size_field_length(version, type) - < 8 * QR_DATA_WORD_COUNT[version - 1][ec ^ 0x1]) + < 8 * (size_t) QR_DATA_WORD_COUNT[version - 1][ec ^ 0x1]) return version; } diff --git a/lpg/libqr/galois.c b/lpg/libqr/galois.c index f0aadfd..decefb0 100644 --- a/lpg/libqr/galois.c +++ b/lpg/libqr/galois.c @@ -83,7 +83,7 @@ struct qr_bitstream * rs_generate_words(struct qr_bitstream * data, unsigned int * b = 0; unsigned int * g; size_t n = rs_words; - int i, r; + size_t i, r; assert(qr_bitstream_remaining(data) >= data_words * 8); diff --git a/lpg/libqr/qr/bitmap.h b/lpg/libqr/qr/bitmap.h index 36c56b3..d4af471 100644 --- a/lpg/libqr/qr/bitmap.h +++ b/lpg/libqr/qr/bitmap.h @@ -8,7 +8,7 @@ struct qr_bitmap { size_t width, height; }; -struct qr_bitmap * qr_bitmap_create(int width, int height, int masked); +struct qr_bitmap * qr_bitmap_create(size_t width, size_t height, int masked); void qr_bitmap_destroy(struct qr_bitmap *); int qr_bitmap_add_mask(struct qr_bitmap *); @@ -19,9 +19,9 @@ void qr_bitmap_merge(struct qr_bitmap * dest, const struct qr_bitmap * src); void qr_bitmap_render(const struct qr_bitmap * bmp, void * buffer, - size_t mod_bits, + int mod_bits, size_t line_stride, - size_t line_repeat, + int line_repeat, unsigned long mark, unsigned long space); diff --git a/lpg/libqr/qr/bitstream.h b/lpg/libqr/qr/bitstream.h index 5ca6b41..9bd8261 100644 --- a/lpg/libqr/qr/bitstream.h +++ b/lpg/libqr/qr/bitstream.h @@ -22,21 +22,21 @@ size_t qr_bitstream_tell(const struct qr_bitstream *); size_t qr_bitstream_remaining(const struct qr_bitstream *); size_t qr_bitstream_size(const struct qr_bitstream *); -unsigned int qr_bitstream_read(struct qr_bitstream *, size_t bits); +unsigned long qr_bitstream_read(struct qr_bitstream *, int bits); void qr_bitstream_unpack(struct qr_bitstream *, unsigned int * result, size_t count, - size_t bitsize); + int bitsize); int qr_bitstream_write(struct qr_bitstream *, - unsigned int value, - size_t bits); + unsigned long value, + int bits); int qr_bitstream_pack(struct qr_bitstream *, const unsigned int * values, size_t count, - size_t bitsize); + int bitsize); int qr_bitstream_cat(struct qr_bitstream *, const struct qr_bitstream * src); diff --git a/lpg/libqr/qr/parse.h b/lpg/libqr/qr/parse.h index d7b8c4e..07a0424 100644 --- a/lpg/libqr/qr/parse.h +++ b/lpg/libqr/qr/parse.h @@ -9,7 +9,7 @@ int qr_code_parse(const void * buffer, size_t line_count, struct qr_data ** data); -int qr_decode_format(unsigned bits, enum qr_ec_level * ec, int * mask); +int qr_decode_format(unsigned long bits, enum qr_ec_level * ec, int * mask); int qr_decode_version(unsigned long bits, int * version); #endif diff --git a/lpg/libqr/qrgen.c b/lpg/libqr/qrgen.c index 6098231..3007011 100644 --- a/lpg/libqr/qrgen.c +++ b/lpg/libqr/qrgen.c @@ -100,7 +100,7 @@ void output_ansi(const struct qr_bitmap * bmp) }; unsigned char * line; - int x, y; + size_t x, y; line = bmp->bits; -- cgit v1.2.3-70-g09d2 From 779e729ad887c1cc967731a9634a11438d56b017 Mon Sep 17 00:00:00 2001 From: Leo Uino Date: Tue, 19 Jul 2011 12:08:33 +0900 Subject: Add C++ header protectors --- lpg/libqr/qr/bitmap.h | 8 ++++++++ lpg/libqr/qr/bitstream.h | 8 ++++++++ lpg/libqr/qr/code.h | 8 ++++++++ lpg/libqr/qr/common.h | 8 ++++++++ lpg/libqr/qr/data.h | 8 ++++++++ lpg/libqr/qr/layout.h | 8 ++++++++ lpg/libqr/qr/parse.h | 8 ++++++++ lpg/libqr/qr/types.h | 8 ++++++++ lpg/libqr/qr/version.h | 8 ++++++++ 9 files changed, 72 insertions(+) (limited to 'lpg/libqr/qr/bitstream.h') diff --git a/lpg/libqr/qr/bitmap.h b/lpg/libqr/qr/bitmap.h index d4af471..72da07f 100644 --- a/lpg/libqr/qr/bitmap.h +++ b/lpg/libqr/qr/bitmap.h @@ -1,6 +1,10 @@ #ifndef QR_BITMAP_H #define QR_BITMAP_H +#ifdef __cplusplus +extern "C" { +#endif + struct qr_bitmap { unsigned char * bits; unsigned char * mask; @@ -25,5 +29,9 @@ void qr_bitmap_render(const struct qr_bitmap * bmp, unsigned long mark, unsigned long space); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/bitstream.h b/lpg/libqr/qr/bitstream.h index 9bd8261..aa431e8 100644 --- a/lpg/libqr/qr/bitstream.h +++ b/lpg/libqr/qr/bitstream.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * Note: when writing / reading multiple bits, the * _most_ significant bits come first in the stream. @@ -45,5 +49,9 @@ int qr_bitstream_copy(struct qr_bitstream * dest, struct qr_bitstream * src, size_t count); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/code.h b/lpg/libqr/qr/code.h index e6eb47c..0f5d49c 100644 --- a/lpg/libqr/qr/code.h +++ b/lpg/libqr/qr/code.h @@ -4,6 +4,10 @@ #include #include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + struct qr_code { int version; struct qr_bitmap * modules; @@ -13,5 +17,9 @@ struct qr_code * qr_code_create(const struct qr_data * data); void qr_code_destroy(struct qr_code *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/common.h b/lpg/libqr/qr/common.h index 640696a..b7052ad 100644 --- a/lpg/libqr/qr/common.h +++ b/lpg/libqr/qr/common.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + void qr_mask_apply(struct qr_bitmap * bmp, int mask); size_t qr_code_total_capacity(int version); @@ -20,5 +24,9 @@ void qr_get_rs_block_sizes(int version, int data_length[2], int ec_length[2]); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/data.h b/lpg/libqr/qr/data.h index f2b4b45..06600ab 100644 --- a/lpg/libqr/qr/data.h +++ b/lpg/libqr/qr/data.h @@ -4,6 +4,10 @@ #include #include "types.h" +#ifdef __cplusplus +extern "C" { +#endif + struct qr_data { int version; /* 1 ~ 40 */ enum qr_ec_level ec; @@ -29,5 +33,9 @@ enum qr_data_type qr_parse_data(const struct qr_data * input, char ** output, size_t * length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/layout.h b/lpg/libqr/qr/layout.h index 49bebf6..e691bdb 100644 --- a/lpg/libqr/qr/layout.h +++ b/lpg/libqr/qr/layout.h @@ -1,6 +1,10 @@ #ifndef QR_CODE_LAYOUT_H #define QR_CODE_LAYOUT_H +#ifdef __cplusplus +extern "C" { +#endif + struct qr_iterator; void qr_layout_init_mask(struct qr_code *); @@ -10,5 +14,9 @@ unsigned int qr_layout_read(struct qr_iterator *); void qr_layout_write(struct qr_iterator *, unsigned int); void qr_layout_end(struct qr_iterator *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/parse.h b/lpg/libqr/qr/parse.h index 07a0424..0e08354 100644 --- a/lpg/libqr/qr/parse.h +++ b/lpg/libqr/qr/parse.h @@ -3,6 +3,10 @@ #include "data.h" +#ifdef __cplusplus +extern "C" { +#endif + int qr_code_parse(const void * buffer, size_t line_bits, size_t line_stride, @@ -12,5 +16,9 @@ int qr_code_parse(const void * buffer, int qr_decode_format(unsigned long bits, enum qr_ec_level * ec, int * mask); int qr_decode_version(unsigned long bits, int * version); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/types.h b/lpg/libqr/qr/types.h index 3615e3e..ae760ab 100644 --- a/lpg/libqr/qr/types.h +++ b/lpg/libqr/qr/types.h @@ -1,6 +1,10 @@ #ifndef QR_TYPES_H #define QR_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + struct qr_data; struct qr_code; @@ -22,5 +26,9 @@ enum qr_ec_level { QR_EC_LEVEL_H = 0x2 }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/lpg/libqr/qr/version.h b/lpg/libqr/qr/version.h index cd263c0..ce540f4 100644 --- a/lpg/libqr/qr/version.h +++ b/lpg/libqr/qr/version.h @@ -1,10 +1,18 @@ #ifndef QR_VERSION_H #define QR_VERSION_H +#ifdef __cplusplus +extern "C" { +#endif + #define QR_VERSION_MAJOR 0 #define QR_VERSION_MINOR 3 #define QR_VERSION "0.3" +#ifdef __cplusplus +} +#endif + #endif -- cgit v1.2.3-70-g09d2