diff options
author | Leo Uino <leo@norisys.jp> | 2011-07-15 14:20:41 +0900 |
---|---|---|
committer | Leo Uino <leo@norisys.jp> | 2011-07-15 14:20:41 +0900 |
commit | 4670274ec303082e0fb86ff3be1ea4170a17662f (patch) | |
tree | e51c1a8fe6cbc5ac04516337b9fce0a2f6aebd09 /lpg/libqr/code-common.c | |
parent | 9f4843d686bca0d75bee174d8249fbf72527b94a (diff) | |
download | pdf-simple-sign-4670274ec303082e0fb86ff3be1ea4170a17662f.tar.gz pdf-simple-sign-4670274ec303082e0fb86ff3be1ea4170a17662f.tar.xz pdf-simple-sign-4670274ec303082e0fb86ff3be1ea4170a17662f.zip |
qr_mask_apply() works in-place
Diffstat (limited to 'lpg/libqr/code-common.c')
-rw-r--r-- | lpg/libqr/code-common.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lpg/libqr/code-common.c b/lpg/libqr/code-common.c index 422f2ac..1cb1745 100644 --- a/lpg/libqr/code-common.c +++ b/lpg/libqr/code-common.c @@ -74,18 +74,12 @@ void qr_get_rs_block_sizes(int version, assert(data_words + ec_words == total_words); } -struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig, - unsigned int mask) +void qr_mask_apply(struct qr_bitmap * bmp, int mask) { - struct qr_bitmap * bmp; int i, j; - if (mask > 7) - return 0; - - bmp = qr_bitmap_clone(orig); - if (!bmp) - return 0; + assert((mask & 0x7) == mask); + mask &= 0x7; /* Slow version for now; we can optimize later */ @@ -111,7 +105,5 @@ struct qr_bitmap * qr_mask_apply(const struct qr_bitmap * orig, p[off] ^= (t == 0) << bit; } } - - return bmp; } |