DataBlock.java (zxing-zxing-3.4.1) | : | DataBlock.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
*/ | */ | |||
static DataBlock[] getDataBlocks(byte[] rawCodewords, | static DataBlock[] getDataBlocks(byte[] rawCodewords, | |||
Version version) { | Version version) { | |||
// Figure out the number and size of data blocks used by this version | // Figure out the number and size of data blocks used by this version | |||
Version.ECBlocks ecBlocks = version.getECBlocks(); | Version.ECBlocks ecBlocks = version.getECBlocks(); | |||
// First count the total number of data blocks | // First count the total number of data blocks | |||
int totalBlocks = 0; | int totalBlocks = 0; | |||
Version.ECB[] ecBlockArray = ecBlocks.getECBlocks(); | Version.ECB[] ecBlockArray = ecBlocks.getECBlocks(); | |||
for (Version.ECB ecBlock : ecBlockArray) { | for (Version.ECB ecBlock : ecBlockArray) { | |||
totalBlocks += ecBlock.getCount(); | totalBlocks += ecBlock.getCount(); | |||
} | } | |||
// Now establish DataBlocks of the appropriate size and number of data codew ords | // Now establish DataBlocks of the appropriate size and number of data codew ords | |||
DataBlock[] result = new DataBlock[totalBlocks]; | DataBlock[] result = new DataBlock[totalBlocks]; | |||
int numResultBlocks = 0; | int numResultBlocks = 0; | |||
for (Version.ECB ecBlock : ecBlockArray) { | for (Version.ECB ecBlock : ecBlockArray) { | |||
for (int i = 0; i < ecBlock.getCount(); i++) { | for (int i = 0; i < ecBlock.getCount(); i++) { | |||
int numDataCodewords = ecBlock.getDataCodewords(); | int numDataCodewords = ecBlock.getDataCodewords(); | |||
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords; | int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords; | |||
result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[num BlockCodewords]); | result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[num BlockCodewords]); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |