mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fix some issues flagged by Coverity static analysis
This commit is contained in:
parent
391e85ea51
commit
4050f5c2f3
|
@ -146,7 +146,10 @@ public final class EncodeActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
File barcodeFile = new File(barcodesRoot, makeBarcodeFileName(contents) + ".png");
|
||||
barcodeFile.delete();
|
||||
if (!barcodeFile.delete()) {
|
||||
Log.w(TAG, "Could not delete " + barcodeFile);
|
||||
// continue anyway
|
||||
}
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(barcodeFile);
|
||||
|
|
|
@ -55,8 +55,7 @@ public abstract class SupplementalInfoRetriever extends AsyncTask<Object,Object,
|
|||
} else if (result instanceof ProductParsedResult) {
|
||||
ProductParsedResult productParsedResult = (ProductParsedResult) result;
|
||||
String productID = productParsedResult.getProductID();
|
||||
String normalizedProductID = productParsedResult.getNormalizedProductID();
|
||||
SupplementalInfoRetriever productRetriever =
|
||||
SupplementalInfoRetriever productRetriever =
|
||||
new ProductResultInfoRetriever(textView, productID, historyManager, context);
|
||||
productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else if (result instanceof ISBNParsedResult) {
|
||||
|
|
|
@ -98,6 +98,9 @@ final class DecodedBitStreamParser {
|
|||
}
|
||||
|
||||
private static int getInt(byte[] bytes, byte[] x) {
|
||||
if (x.length == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
int val = 0;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
val += getBit(x[i], bytes) << (x.length - i - 1);
|
||||
|
|
|
@ -305,6 +305,9 @@ final class MatrixUtil {
|
|||
// Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit
|
||||
// operations. We don't care if cofficients are positive or negative.
|
||||
static int calculateBCHCode(int value, int poly) {
|
||||
if (poly == 0) {
|
||||
throw new IllegalArgumentException("0 polynomial");
|
||||
}
|
||||
// If poly is "1 1111 0010 0101" (version info poly), msbSetInPoly is 13. We'll subtract 1
|
||||
// from 13 to make it 12.
|
||||
int msbSetInPoly = findMSBSet(poly);
|
||||
|
|
Loading…
Reference in a new issue