aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/code-common.c
diff options
context:
space:
mode:
authorLeo Howell <leo@lwh.jp>2009-10-08 14:38:37 +0900
committerLeo Howell <leo@lwh.jp>2009-10-08 14:38:37 +0900
commit62e8a6f2ad89be06c7e649c0fc4c564ecad2d070 (patch)
treea870eb56ba9c02e5807d3ce3d556bca98c1f2e8c /lpg/libqr/code-common.c
parentad59de83b7f82cb812d23ac2bb948ac32fe0ac71 (diff)
downloadpdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.tar.gz
pdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.tar.xz
pdf-simple-sign-62e8a6f2ad89be06c7e649c0fc4c564ecad2d070.zip
code format --> version
Diffstat (limited to 'lpg/libqr/code-common.c')
-rw-r--r--lpg/libqr/code-common.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/lpg/libqr/code-common.c b/lpg/libqr/code-common.c
index 32f6492..dc2a8f0 100644
--- a/lpg/libqr/code-common.c
+++ b/lpg/libqr/code-common.c
@@ -14,26 +14,21 @@ void qr_code_destroy(struct qr_code * code)
int qr_code_width(const struct qr_code * code)
{
- return code_side_length(code->format);
+ return code->version * 4 + 17;
}
-int code_side_length(int format)
+size_t code_total_capacity(int version)
{
- return format * 4 + 17;
-}
-
-size_t code_total_capacity(int format)
-{
- int side = format * 4 + 17;
+ int side = version * 4 + 17;
- int alignment_side = format > 1 ? (format / 7) + 2 : 0;
+ int alignment_side = version > 1 ? (version / 7) + 2 : 0;
int alignment_count = alignment_side >= 2 ?
alignment_side * alignment_side - 3 : 0;
int locator_bits = 8*8*3;
- int format_bits = 8*4 - 1 + (format >= 7 ? 6*3*2 : 0);
+ int format_bits = 8*4 - 1 + (version >= 7 ? 6*3*2 : 0);
int timing_bits = 2 * (side - 8*2 -
(alignment_side > 2 ? (alignment_side - 2) * 5 : 0));