← Back to team overview

hugin-devs team mailing list archive

[Bug 1538500] [NEW] Possible misbehaviour due to lack of parentheses

 

Public bug reported:

I do not know Hugin's code very well but fixing these warnings should be
trivial for someone who does:

d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp: In function 'void HuginBase::Nona::stitchPanorama(const HuginBase::PanoramaData&, const HuginBase::PanoramaOptions&, AppBase::ProgressDisplay*, const string&, const UIntSet&, const AdvancedOptions&)':
d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:97:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         if (bands == 1 || bands == 2 && extraBands == 1) {
                                      ^
d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:99:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         } else if (bands == 3 || bands == 4 && extraBands == 1) {
                                             ^
d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:107:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         if (bands == 1 || bands == 2 && extraBands == 1) {
                                      ^
d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:116:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         } else if (bands == 3 || bands == 4 && extraBands == 1) {

=============================================================================

d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp: In member function 'bool HuginBase::PanoramaMemento::loadPTScript(std::istream&, int&, const string&)':
d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp:2949:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
             if (iImgInfo[i].links[*v] == -2 && oImgInfo[i].links[*v] != -2 || iImgInfo[i].links[*v] == -1 && oImgInfo[i].links[*v] >=0) {

=============================================================================

d:/Works/Hugin/src/tools/cpclean.cpp: In function 'int main(int, char**)':
d:/Works/Hugin/src/tools/cpclean.cpp:243:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
     if(!onlyPair)
       ^

** Affects: hugin
     Importance: Undecided
         Status: New

** Description changed:

  I do not know Hugin's code very well but fixing these warnings should be
  trivial for someone who does:
  
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp: In function 'void HuginBase::Nona::stitchPanorama(const HuginBase::PanoramaData&, const HuginBase::PanoramaOptions&, AppBase::ProgressDisplay*, const string&, const UIntSet&, const AdvancedOptions&)':
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:97:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
-          if (bands == 1 || bands == 2 && extraBands == 1) {
-                                       ^
+          if (bands == 1 || bands == 2 && extraBands == 1) {
+                                       ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:99:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
-          } else if (bands == 3 || bands == 4 && extraBands == 1) {
-                                              ^
+          } else if (bands == 3 || bands == 4 && extraBands == 1) {
+                                              ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:107:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
-          if (bands == 1 || bands == 2 && extraBands == 1) {
-                                       ^
+          if (bands == 1 || bands == 2 && extraBands == 1) {
+                                       ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:116:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
-          } else if (bands == 3 || bands == 4 && extraBands == 1) {
+          } else if (bands == 3 || bands == 4 && extraBands == 1) {
  
- =====================================================================================================
+ =============================================================================
  
  d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp: In member function 'bool HuginBase::PanoramaMemento::loadPTScript(std::istream&, int&, const string&)':
  d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp:2949:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
-              if (iImgInfo[i].links[*v] == -2 && oImgInfo[i].links[*v] != -2 || iImgInfo[i].links[*v] == -1 && oImgInfo[i].links[*v] >=0) {
+              if (iImgInfo[i].links[*v] == -2 && oImgInfo[i].links[*v] != -2 || iImgInfo[i].links[*v] == -1 && oImgInfo[i].links[*v] >=0) {
  
- =====================================================================================================
+ =============================================================================
  
  d:/Works/Hugin/src/tools/cpclean.cpp: In function 'int main(int, char**)':
  d:/Works/Hugin/src/tools/cpclean.cpp:243:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
-      if(!onlyPair)
-        ^
+      if(!onlyPair)
+        ^

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Hugin.
https://bugs.launchpad.net/bugs/1538500

Title:
  Possible misbehaviour due to lack of parentheses

Status in Hugin:
  New

Bug description:
  I do not know Hugin's code very well but fixing these warnings should
  be trivial for someone who does:

  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp: In function 'void HuginBase::Nona::stitchPanorama(const HuginBase::PanoramaData&, const HuginBase::PanoramaOptions&, AppBase::ProgressDisplay*, const string&, const UIntSet&, const AdvancedOptions&)':
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:97:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
           if (bands == 1 || bands == 2 && extraBands == 1) {
                                        ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:99:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
           } else if (bands == 3 || bands == 4 && extraBands == 1) {
                                               ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:107:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
           if (bands == 1 || bands == 2 && extraBands == 1) {
                                        ^
  d:/Works/Hugin/src/hugin_base/nona/Stitcher.cpp:116:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
           } else if (bands == 3 || bands == 4 && extraBands == 1) {

  =============================================================================

  d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp: In member function 'bool HuginBase::PanoramaMemento::loadPTScript(std::istream&, int&, const string&)':
  d:/Works/Hugin/src/hugin_base/panodata/Panorama.cpp:2949:45: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
               if (iImgInfo[i].links[*v] == -2 && oImgInfo[i].links[*v] != -2 || iImgInfo[i].links[*v] == -1 && oImgInfo[i].links[*v] >=0) {

  =============================================================================

  d:/Works/Hugin/src/tools/cpclean.cpp: In function 'int main(int, char**)':
  d:/Works/Hugin/src/tools/cpclean.cpp:243:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
       if(!onlyPair)
         ^

To manage notifications about this bug go to:
https://bugs.launchpad.net/hugin/+bug/1538500/+subscriptions


Follow ups