diff options
-rw-r--r-- | lpg/libqr/code-create.c | 13 | ||||
-rw-r--r-- | lpg/libqr/constants.h | 8 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lpg/libqr/code-create.c b/lpg/libqr/code-create.c index d00a41f..cf04eb7 100644 --- a/lpg/libqr/code-create.c +++ b/lpg/libqr/code-create.c @@ -25,8 +25,8 @@ static int draw_format(struct qr_bitmap * bmp, struct qr_code * code, enum qr_ec_level ec, int mask); -static int calc_format_bits(enum qr_ec_level ec, int mask); -static long calc_version_bits(int version); +static unsigned int calc_format_bits(enum qr_ec_level ec, int mask); +static unsigned long calc_version_bits(int version); #include <stdio.h> static void x_dump(struct qr_bitstream * bits) @@ -557,9 +557,9 @@ static int draw_format(struct qr_bitmap * bmp, return 0; } -static int calc_format_bits(enum qr_ec_level ec, int mask) +static unsigned int calc_format_bits(enum qr_ec_level ec, int mask) { - int bits; + unsigned int bits; bits = (ec & 0x3) << 3 | (mask & 0x7); @@ -573,9 +573,9 @@ static int calc_format_bits(enum qr_ec_level ec, int mask) return bits; } -static long calc_version_bits(int version) +static unsigned long calc_version_bits(int version) { - long bits; + unsigned long bits; bits = version & 0x3F; @@ -584,7 +584,6 @@ static long calc_version_bits(int version) bits <<= 18 - 6; bits |= gf_residue(bits, QR_VERSION_POLY); -fprintf(stderr, "version bits: %lx\n", bits); return bits; } diff --git a/lpg/libqr/constants.h b/lpg/libqr/constants.h index e6cfa3c..c13ae5a 100644 --- a/lpg/libqr/constants.h +++ b/lpg/libqr/constants.h @@ -4,20 +4,20 @@ #include <qr/types.h> /* XOR mask for format data: 101 0100 0001 0010 */ -#define QR_FORMAT_MASK (0x5412) +static const unsigned int QR_FORMAT_MASK = 0x5412; /* Format info EC polynomial * G(x) = x^10 + x^8 + x^5 + x^4 + x^2 + x + 1 */ -#define QR_FORMAT_POLY (0x537) +static const unsigned int QR_FORMAT_POLY = 0x537; /* Version info EC polynomial * G(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1 */ -#define QR_VERSION_POLY (0x1F25) +static const unsigned int QR_VERSION_POLY = 0x1F25; /* A QR-code word is always 8 bits, but CHAR_BIT might not be */ -#define QR_WORD_BITS (8) +static const unsigned int QR_WORD_BITS = 8; extern const int QR_ALIGNMENT_LOCATION[40][7]; extern const int QR_DATA_WORD_COUNT[40][4]; |