[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master ee16bf5 2/2: Matrix check in ImageWarp made mo
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master ee16bf5 2/2: Matrix check in ImageWarp made more clear |
Date: |
Sun, 24 Jul 2016 00:40:27 +0000 (UTC) |
branch: master
commit ee16bf5a86fe1554a21b70d6bf520821a121bce9
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Matrix check in ImageWarp made more clear
The matrix check conditions in ImageWarp's 'ui.c' had an '&&' and '||'
called together. This created a warning in GCC 6.1.1: "warning: suggest
parentheses around ‘&&’ within ‘||’ [-Wparentheses]". The precedence of
'&&' is higher than '||' in C so the size conditions were not
ambiguous. However it would be more clear to have parenthesis.
To make the check more clear, the first condition (p->up.matrixname is
non-NULL) was moved to a separate 'if' statement and a parenthesis was put
around the first '&&'.
---
src/imgwarp/ui.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/imgwarp/ui.c b/src/imgwarp/ui.c
index e6d5a18..41adc4a 100644
--- a/src/imgwarp/ui.c
+++ b/src/imgwarp/ui.c
@@ -329,11 +329,11 @@ sanitycheck(struct imgwarpparams *p)
/* Check the size of the input matrix, note that it might only have
the wrong numbers when it is read from a file. */
- if(p->up.matrixname
- && (p->ms0!=2 && p->ms0!=3 || p->ms0!=p->ms1))
- error(EXIT_FAILURE, 0, "the given matrix in %s has %lu rows and %lu "
- "columns. Its size must be either 2x2 or 3x3", p->up.matrixname,
- p->ms0, p->ms1);
+ if(p->up.matrixname)
+ if( (p->ms0 != 2 && p->ms0 != 3) || p->ms0 != p->ms1 )
+ error(EXIT_FAILURE, 0, "the given matrix in %s has %lu rows and "
+ "%lu columns. Its size must be either 2x2 or 3x3",
+ p->up.matrixname, p->ms0, p->ms1);
/* Check if there are any non-normal numbers in the matrix: */
df=(d=m)+p->ms0*p->ms1;