Skip to content

Commit 85d9d7f

Browse files
vigrecojozefizso
authored andcommitted
Use unix line endings in source code files
Backports <soldair#386>
1 parent 049879d commit 85d9d7f

2 files changed

Lines changed: 426 additions & 426 deletions

File tree

lib/core/error-correction-code.js

Lines changed: 135 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,135 @@
1-
const ECLevel = require('./error-correction-level')
2-
3-
const EC_BLOCKS_TABLE = [
4-
// L M Q H
5-
1, 1, 1, 1,
6-
1, 1, 1, 1,
7-
1, 1, 2, 2,
8-
1, 2, 2, 4,
9-
1, 2, 4, 4,
10-
2, 4, 4, 4,
11-
2, 4, 6, 5,
12-
2, 4, 6, 6,
13-
2, 5, 8, 8,
14-
4, 5, 8, 8,
15-
4, 5, 8, 11,
16-
4, 8, 10, 11,
17-
4, 9, 12, 16,
18-
4, 9, 16, 16,
19-
6, 10, 12, 18,
20-
6, 10, 17, 16,
21-
6, 11, 16, 19,
22-
6, 13, 18, 21,
23-
7, 14, 21, 25,
24-
8, 16, 20, 25,
25-
8, 17, 23, 25,
26-
9, 17, 23, 34,
27-
9, 18, 25, 30,
28-
10, 20, 27, 32,
29-
12, 21, 29, 35,
30-
12, 23, 34, 37,
31-
12, 25, 34, 40,
32-
13, 26, 35, 42,
33-
14, 28, 38, 45,
34-
15, 29, 40, 48,
35-
16, 31, 43, 51,
36-
17, 33, 45, 54,
37-
18, 35, 48, 57,
38-
19, 37, 51, 60,
39-
19, 38, 53, 63,
40-
20, 40, 56, 66,
41-
21, 43, 59, 70,
42-
22, 45, 62, 74,
43-
24, 47, 65, 77,
44-
25, 49, 68, 81
45-
]
46-
47-
const EC_CODEWORDS_TABLE = [
48-
// L M Q H
49-
7, 10, 13, 17,
50-
10, 16, 22, 28,
51-
15, 26, 36, 44,
52-
20, 36, 52, 64,
53-
26, 48, 72, 88,
54-
36, 64, 96, 112,
55-
40, 72, 108, 130,
56-
48, 88, 132, 156,
57-
60, 110, 160, 192,
58-
72, 130, 192, 224,
59-
80, 150, 224, 264,
60-
96, 176, 260, 308,
61-
104, 198, 288, 352,
62-
120, 216, 320, 384,
63-
132, 240, 360, 432,
64-
144, 280, 408, 480,
65-
168, 308, 448, 532,
66-
180, 338, 504, 588,
67-
196, 364, 546, 650,
68-
224, 416, 600, 700,
69-
224, 442, 644, 750,
70-
252, 476, 690, 816,
71-
270, 504, 750, 900,
72-
300, 560, 810, 960,
73-
312, 588, 870, 1050,
74-
336, 644, 952, 1110,
75-
360, 700, 1020, 1200,
76-
390, 728, 1050, 1260,
77-
420, 784, 1140, 1350,
78-
450, 812, 1200, 1440,
79-
480, 868, 1290, 1530,
80-
510, 924, 1350, 1620,
81-
540, 980, 1440, 1710,
82-
570, 1036, 1530, 1800,
83-
570, 1064, 1590, 1890,
84-
600, 1120, 1680, 1980,
85-
630, 1204, 1770, 2100,
86-
660, 1260, 1860, 2220,
87-
720, 1316, 1950, 2310,
88-
750, 1372, 2040, 2430
89-
]
90-
91-
/**
92-
* Returns the number of error correction block that the QR Code should contain
93-
* for the specified version and error correction level.
94-
*
95-
* @param {Number} version QR Code version
96-
* @param {Number} errorCorrectionLevel Error correction level
97-
* @return {Number} Number of error correction blocks
98-
*/
99-
exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
100-
switch (errorCorrectionLevel) {
101-
case ECLevel.L:
102-
return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
103-
case ECLevel.M:
104-
return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
105-
case ECLevel.Q:
106-
return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
107-
case ECLevel.H:
108-
return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
109-
default:
110-
return undefined
111-
}
112-
}
113-
114-
/**
115-
* Returns the number of error correction codewords to use for the specified
116-
* version and error correction level.
117-
*
118-
* @param {Number} version QR Code version
119-
* @param {Number} errorCorrectionLevel Error correction level
120-
* @return {Number} Number of error correction codewords
121-
*/
122-
exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
123-
switch (errorCorrectionLevel) {
124-
case ECLevel.L:
125-
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
126-
case ECLevel.M:
127-
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
128-
case ECLevel.Q:
129-
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
130-
case ECLevel.H:
131-
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
132-
default:
133-
return undefined
134-
}
135-
}
1+
const ECLevel = require('./error-correction-level')
2+
3+
const EC_BLOCKS_TABLE = [
4+
// L M Q H
5+
1, 1, 1, 1,
6+
1, 1, 1, 1,
7+
1, 1, 2, 2,
8+
1, 2, 2, 4,
9+
1, 2, 4, 4,
10+
2, 4, 4, 4,
11+
2, 4, 6, 5,
12+
2, 4, 6, 6,
13+
2, 5, 8, 8,
14+
4, 5, 8, 8,
15+
4, 5, 8, 11,
16+
4, 8, 10, 11,
17+
4, 9, 12, 16,
18+
4, 9, 16, 16,
19+
6, 10, 12, 18,
20+
6, 10, 17, 16,
21+
6, 11, 16, 19,
22+
6, 13, 18, 21,
23+
7, 14, 21, 25,
24+
8, 16, 20, 25,
25+
8, 17, 23, 25,
26+
9, 17, 23, 34,
27+
9, 18, 25, 30,
28+
10, 20, 27, 32,
29+
12, 21, 29, 35,
30+
12, 23, 34, 37,
31+
12, 25, 34, 40,
32+
13, 26, 35, 42,
33+
14, 28, 38, 45,
34+
15, 29, 40, 48,
35+
16, 31, 43, 51,
36+
17, 33, 45, 54,
37+
18, 35, 48, 57,
38+
19, 37, 51, 60,
39+
19, 38, 53, 63,
40+
20, 40, 56, 66,
41+
21, 43, 59, 70,
42+
22, 45, 62, 74,
43+
24, 47, 65, 77,
44+
25, 49, 68, 81
45+
]
46+
47+
const EC_CODEWORDS_TABLE = [
48+
// L M Q H
49+
7, 10, 13, 17,
50+
10, 16, 22, 28,
51+
15, 26, 36, 44,
52+
20, 36, 52, 64,
53+
26, 48, 72, 88,
54+
36, 64, 96, 112,
55+
40, 72, 108, 130,
56+
48, 88, 132, 156,
57+
60, 110, 160, 192,
58+
72, 130, 192, 224,
59+
80, 150, 224, 264,
60+
96, 176, 260, 308,
61+
104, 198, 288, 352,
62+
120, 216, 320, 384,
63+
132, 240, 360, 432,
64+
144, 280, 408, 480,
65+
168, 308, 448, 532,
66+
180, 338, 504, 588,
67+
196, 364, 546, 650,
68+
224, 416, 600, 700,
69+
224, 442, 644, 750,
70+
252, 476, 690, 816,
71+
270, 504, 750, 900,
72+
300, 560, 810, 960,
73+
312, 588, 870, 1050,
74+
336, 644, 952, 1110,
75+
360, 700, 1020, 1200,
76+
390, 728, 1050, 1260,
77+
420, 784, 1140, 1350,
78+
450, 812, 1200, 1440,
79+
480, 868, 1290, 1530,
80+
510, 924, 1350, 1620,
81+
540, 980, 1440, 1710,
82+
570, 1036, 1530, 1800,
83+
570, 1064, 1590, 1890,
84+
600, 1120, 1680, 1980,
85+
630, 1204, 1770, 2100,
86+
660, 1260, 1860, 2220,
87+
720, 1316, 1950, 2310,
88+
750, 1372, 2040, 2430
89+
]
90+
91+
/**
92+
* Returns the number of error correction block that the QR Code should contain
93+
* for the specified version and error correction level.
94+
*
95+
* @param {Number} version QR Code version
96+
* @param {Number} errorCorrectionLevel Error correction level
97+
* @return {Number} Number of error correction blocks
98+
*/
99+
exports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {
100+
switch (errorCorrectionLevel) {
101+
case ECLevel.L:
102+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
103+
case ECLevel.M:
104+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
105+
case ECLevel.Q:
106+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
107+
case ECLevel.H:
108+
return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
109+
default:
110+
return undefined
111+
}
112+
}
113+
114+
/**
115+
* Returns the number of error correction codewords to use for the specified
116+
* version and error correction level.
117+
*
118+
* @param {Number} version QR Code version
119+
* @param {Number} errorCorrectionLevel Error correction level
120+
* @return {Number} Number of error correction codewords
121+
*/
122+
exports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {
123+
switch (errorCorrectionLevel) {
124+
case ECLevel.L:
125+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
126+
case ECLevel.M:
127+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
128+
case ECLevel.Q:
129+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
130+
case ECLevel.H:
131+
return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
132+
default:
133+
return undefined
134+
}
135+
}

0 commit comments

Comments
 (0)