several backported fixes (some are not supported and are not included in tests)

This commit is contained in:
Henry Schimke
2023-01-28 18:33:58 -06:00
parent e4f6fe0daf
commit e024573905
6 changed files with 9 additions and 8 deletions

View File

@@ -106,9 +106,7 @@ impl ECIStringBuilder {
pub fn appendECI(&mut self, value: u32) -> Result<(), Exceptions> { pub fn appendECI(&mut self, value: u32) -> Result<(), Exceptions> {
self.encodeCurrentBytesIfAny(); self.encodeCurrentBytesIfAny();
let character_set_eci = CharacterSetECI::getCharacterSetECIByValue(value)?; let character_set_eci = CharacterSetECI::getCharacterSetECIByValue(value)?;
// if (character_set_eci == null) {
// throw FormatException.getFormatInstance();
// }
self.current_charset = CharacterSetECI::getCharset(&character_set_eci); self.current_charset = CharacterSetECI::getCharset(&character_set_eci);
Ok(()) Ok(())
} }

View File

@@ -688,7 +688,7 @@ fn decodeECISegment(bits: &mut BitSource, result: &mut ECIStringBuilder) -> Resu
let secondByte = bits.readBits(8)?; let secondByte = bits.readBits(8)?;
if firstByte <= 191 { if firstByte <= 191 {
return result.appendECI(firstByte - 1); return result.appendECI((firstByte - 128) * 254 + 127 + secondByte - 1);
} }
let thirdByte = bits.readBits(8)?; let thirdByte = bits.readBits(8)?;

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

@@ -0,0 +1,2 @@
symbologyIdentifier=]d1
readerInit=true

View File

@@ -0,0 +1 @@
$I

View File

@@ -29,10 +29,10 @@ fn data_matrix_black_box1_test_case() {
rxing::BarcodeFormat::DATA_MATRIX, rxing::BarcodeFormat::DATA_MATRIX,
); );
// super("src/test/resources/blackbox/datamatrix-1", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX); // super("src/test/resources/blackbox/datamatrix-1", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
tester.add_test(27, 28, 0.0); tester.add_test(27, 27, 0.0);
tester.add_test(21, 26, 90.0); tester.add_test(21, 25, 90.0);
tester.add_test(21, 26, 180.0); tester.add_test(21, 25, 180.0);
tester.add_test(21, 26, 270.0); tester.add_test(21, 25, 270.0);
tester.test_black_box(); tester.test_black_box();
} }