initialize valarrays with explicit contents (zero)
[zxing.git] / cpp / core / src / qrcode / detector / FinderPatternFinder.cpp
index 3138b27..3c120db 100644 (file)
@@ -3,7 +3,7 @@
  *  zxing
  *
  *  Created by Christian Brunschen on 13/05/2008.
- *  Copyright 2008 Google Inc. All rights reserved.
+ *  Copyright 2008 ZXing authors All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ namespace qrcode {
                                                   int originalStateCountTotal) {
       
       int maxI = image_->getHeight();
-      valarray<int> stateCount(5);
+      valarray<int> stateCount((const int)0, 5);
       
       // Start counting up from center
       int i = startI;
@@ -152,7 +152,7 @@ namespace qrcode {
     {
       
       int maxJ = image_->getWidth();
-      valarray<int> stateCount(5);
+      valarray<int> stateCount((const int)0, 5);
       
       int j = startJ;
       while (j >= 0 && image_->isBlack(j, centerI)) {
@@ -269,8 +269,8 @@ namespace qrcode {
             // difference in the x / y coordinates of the two centers.
             // This is the case where you find top left first. Draw it out.
             hasSkipped_ = true;
-            return (int) abs(abs(firstConfirmedCenter->getX() - center->getX()) -
-                             abs(firstConfirmedCenter->getY() - center->getY()));
+            return (int) (abs(firstConfirmedCenter->getX() - center->getX()) -
+                          abs(firstConfirmedCenter->getY() - center->getY()));
           }
         }
       }