Related to Issue 205, but not the direct issue: read both copies of the format info...
[zxing.git] / core / src / com / google / zxing / qrcode / decoder / BitMatrixParser.java
index c6f79b3..2a820ec 100644 (file)
@@ -54,36 +54,31 @@ final class BitMatrixParser {
     }\r
 \r
     // Read top-left format info bits\r
-    int formatInfoBits = 0;\r
+    int formatInfoBits1 = 0;\r
     for (int i = 0; i < 6; i++) {\r
-      formatInfoBits = copyBit(i, 8, formatInfoBits);\r
+      formatInfoBits1 = copyBit(i, 8, formatInfoBits1);\r
     }\r
     // .. and skip a bit in the timing pattern ...\r
-    formatInfoBits = copyBit(7, 8, formatInfoBits);\r
-    formatInfoBits = copyBit(8, 8, formatInfoBits);\r
-    formatInfoBits = copyBit(8, 7, formatInfoBits);\r
+    formatInfoBits1 = copyBit(7, 8, formatInfoBits1);\r
+    formatInfoBits1 = copyBit(8, 8, formatInfoBits1);\r
+    formatInfoBits1 = copyBit(8, 7, formatInfoBits1);\r
     // .. and skip a bit in the timing pattern ...\r
     for (int j = 5; j >= 0; j--) {\r
-      formatInfoBits = copyBit(8, j, formatInfoBits);\r
+      formatInfoBits1 = copyBit(8, j, formatInfoBits1);\r
     }\r
 \r
-    parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r
-    if (parsedFormatInfo != null) {\r
-      return parsedFormatInfo;\r
-    }\r
-\r
-    // Hmm, failed. Try the top-right/bottom-left pattern\r
+    // Read the top-right/bottom-left pattern too\r
     int dimension = bitMatrix.getDimension();\r
-    formatInfoBits = 0;\r
+    int formatInfoBits2 = 0;\r
     int iMin = dimension - 8;\r
     for (int i = dimension - 1; i >= iMin; i--) {\r
-      formatInfoBits = copyBit(i, 8, formatInfoBits);\r
+      formatInfoBits2 = copyBit(i, 8, formatInfoBits2);\r
     }\r
     for (int j = dimension - 7; j < dimension; j++) {\r
-      formatInfoBits = copyBit(8, j, formatInfoBits);\r
+      formatInfoBits2 = copyBit(8, j, formatInfoBits2);\r
     }\r
 \r
-    parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r
+    parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits1, formatInfoBits2);\r
     if (parsedFormatInfo != null) {\r
       return parsedFormatInfo;\r
     }\r