Spelt / ZXing.Delphi

ZXing Barcode Scanning object Pascal Library for Delphi VCL and Delphi Firemonkey
Apache License 2.0
471 stars 206 forks source link

"Interger overflow" error occur #133

Closed wwq0071 closed 1 year ago

wwq0071 commented 2 years ago

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

DValue commented 2 years ago

It happens to me, too, quite often

Spelt commented 2 years ago

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

DValue commented 2 years ago

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

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

Spelt commented 2 years ago

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?

wwq0071 commented 2 years ago

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

On Windows 32 or 64.

wwq0071 commented 2 years ago

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

Spelt commented 2 years ago

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 commented 1 year ago

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