ZXing.Delphi icon indicating copy to clipboard operation
ZXing.Delphi copied to clipboard

"Interger overflow" error occur

Open wwq0071 opened this issue 3 years ago • 7 comments

1 I can't recognize this picture。it raise an error "Interger overflow" ,and This QR code is legal!!!

wwq0071 avatar May 20 '22 03:05 wwq0071

It happens to me, too, quite often

DValue avatar Jun 01 '22 01:06 DValue

Which platform ? Windows 32? Winows 64? IOS? Or Android?

Spelt avatar Jun 01 '22 16:06 Spelt

Which platform ? Windows 32? Winows 64? IOS? Or Android?

My problem appears in Android,1D or 2D encountered

DValue avatar Jun 01 '22 16:06 DValue

On Windows and IOS64 it works.

I don't have an Android here to test. That has to wait.

Do you use PURE_BARCODE ? Like:

hints := TDictionary<TDecodeHintType, TObject>.Create(); hints.Add(TDecodeHintType.PURE_BARCODE, nil); result := Decode('problem-qr-android 64bit.png', TBarcodeFormat.QR_CODE, hints);

If you do can you try again without this option?

Spelt avatar Jun 01 '22 17:06 Spelt

Which platform ? Windows 32? Winows 64? IOS? Or Android?

On Windows 32 or 64.

wwq0071 avatar Jun 02 '22 00:06 wwq0071

you can try "vclTestApp" this demo to build it with win32. and use the QR Code Pictures I provided to test!

wwq0071 avatar Jun 02 '22 06:06 wwq0071

Hi,

I provided an update.

The cause of this over flow bug is in the EAN decoder. What exacly the cause of this bug is is unknown. I fixed it by eating the exception. It will happen only once when scanning the same type of barcodes. If there is an attached Delphi debugger the exception will still be thrown in the IDE.

Some extra information: When the decoder is set to TBarcodeFormat.Auto then all the available 1D decoders (Like EAN, Code128) and then all 2D decoders (QRCode) gets executed in that order until a decode is successfull. If a barcode is successfully decoded then this decoder will be set in the top of the decoder list so when a next scan happens the first decoder will probably be the succesfull decoder.

if you know in front that you only scan QR Codes then you can also set:
result := Decode('q8.png', TBarcodeFormat.QR_CODE);

Spelt avatar Jun 03 '22 14:06 Spelt

I close this one. If there are any problems, please reopen.

Spelt avatar Nov 18 '22 23:11 Spelt