gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master c6a4b60: Installation: corrected several compi


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c6a4b60: Installation: corrected several compiler warnings
Date: Wed, 9 Dec 2020 18:56:27 -0500 (EST)

branch: master
commit c6a4b60fa620dd339e414b3022a57409a5be7d88
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Installation: corrected several compiler warnings
    
    Mahdieh Navabi repoted several compiler warnings that occurred on
    macOS. With this commit they have been addressed.
---
 bin/arithmetic/arithmetic.c |  2 +-
 bin/table/arithmetic.c      |  2 +-
 bin/warp/warp.c             |  4 ++--
 lib/wcsdistortion.c         | 16 ++++------------
 4 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index e69066a..c8ab7ef 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -840,8 +840,8 @@ arithmetic_interpolate_region(struct arithmeticparams *p,
 static void
 arithmetic_interpolate(struct arithmeticparams *p, int operator, char *token)
 {
-  int num_int, interpop;
   gal_data_t *interpolated;
+  int num_int, interpop=GAL_ARITHMETIC_OP_INVALID;
 
   /* First pop the number of nearby neighbors.*/
   gal_data_t *num = operands_pop(p, token);
diff --git a/bin/table/arithmetic.c b/bin/table/arithmetic.c
index 94fadcb..a2e235f 100644
--- a/bin/table/arithmetic.c
+++ b/bin/table/arithmetic.c
@@ -456,9 +456,9 @@ static void
 arithmetic_distance(struct tableparams *p, gal_data_t **stack, int operator)
 {
   size_t i, j;
-  char *colname, *colcomment;
   double *o, *a1, *a2, *b1, *b2;
   gal_data_t *a, *b, *tmp, *out;
+  char *colname=NULL, *colcomment=NULL;
   double (*distance_func)(double, double, double, double);
 
   /* Pop the columns for point 'b'.*/
diff --git a/bin/warp/warp.c b/bin/warp/warp.c
index fc2e566..79e6b1e 100644
--- a/bin/warp/warp.c
+++ b/bin/warp/warp.c
@@ -341,8 +341,8 @@ warp_preparations(struct warpparams *p)
      but in that scenario, we don't want this feature! */
   if( p->centeroncorner==0 && (matrix[2]!=0.0f || matrix[5]!=0.0f) )
     {
-      dsize[1] += abs(matrix[2])+1;
-      dsize[0] += abs(matrix[5])+1;
+      dsize[1] += abs( (int)(matrix[2]) )+1; /* (int): avoid warnings. */
+      dsize[0] += abs( (int)(matrix[5]) )+1;
       if(xmin>0) p->outfpixval[0]=0;
       if(ymin>0) p->outfpixval[1]=0;
     }
diff --git a/lib/wcsdistortion.c b/lib/wcsdistortion.c
index 5b0b285..29cc624 100644
--- a/lib/wcsdistortion.c
+++ b/lib/wcsdistortion.c
@@ -88,7 +88,6 @@ wcsdistortion_get_tpvparams(struct wcsprm *wcs, double 
cd[2][2],
   disseq=wcs->lin.disseq;
   keyp=disseq->dp;
 
-
   /* Fill the 2-times allocated CD array (cd[][]). Note that the required
     CD matix is extracted using the `gal_wcs_wrap_matrix` as a single
     allocated array (temp_cd[]), that is then used to fill cd[][]. */
@@ -110,8 +109,7 @@ wcsdistortion_get_tpvparams(struct wcsprm *wcs, double 
cd[2][2],
       /* For axis1. */
       if (keyp->j == 1)
         {
-          /* Ignore any missing keyvalues. */
-          if ( keyp->field == NULL ) continue;
+          if ( keyp->field[0] == '\0' ) continue;
           cp = strchr(keyp->field, '.') + 1;
           if (strncmp(cp, "TPV.", 4) != 0) continue;
           cp += 4;
@@ -127,9 +125,7 @@ wcsdistortion_get_tpvparams(struct wcsprm *wcs, double 
cd[2][2],
       /* For axis2. */
       else if (keyp->j == 2)
         {
-          /* Ignore any missing keyvalues. */
-          if ( keyp->field == NULL ) continue;
-
+          if ( keyp->field[0] == '\0' ) continue;
           cp = strchr(keyp->field, '.') + 1;
           if (strncmp(cp, "TPV.", 4) != 0) continue;
           cp += 4;
@@ -207,9 +203,7 @@ wcsdistortion_get_sipparams(struct wcsprm *wcs, double 
cd[2][2],
       /* For axis1. */
       if (keyp->j == 1)
         {
-          /* Ignore any missing keyvalues. */
-          if ( keyp->field == NULL ) continue;
-
+          if ( keyp->field[0] == '\0' ) continue;
           cp = strchr(keyp->field, '.') + 1;
           if (strncmp(cp, "SIP.FWD.", 8) != 0) continue;
           cp += 8;
@@ -225,9 +219,7 @@ wcsdistortion_get_sipparams(struct wcsprm *wcs, double 
cd[2][2],
       /* For axis2. */
       else if (keyp->j == 2)
         {
-          /* Ignore any missing keyvalues. */
-          if ( keyp->field == NULL ) continue;
-
+          if ( keyp->field[0] == '\0' ) continue;
           cp = strchr(keyp->field, '.') + 1;
           if (strncmp(cp, "SIP.FWD.", 8) != 0) continue;
           cp += 8;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]