gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master be4b72d: Build: minor corrections to avoid com


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master be4b72d: Build: minor corrections to avoid compiler warnings
Date: Sun, 2 Jun 2019 17:28:13 -0400 (EDT)

branch: master
commit be4b72d7027a33b633a3f998ed81f039159dfe19
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Build: minor corrections to avoid compiler warnings
    
    After testing on an older 32-bit system (a GNU/Linux distro on an Android
    phone!), I found some compiler warnings that have been corrected in this
    commit.
---
 bin/fits/keywords.c    | 6 +++---
 bin/match/ui.c         | 5 ++++-
 bin/table/arithmetic.c | 8 ++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/bin/fits/keywords.c b/bin/fits/keywords.c
index 61bb435..f7346ff 100644
--- a/bin/fits/keywords.c
+++ b/bin/fits/keywords.c
@@ -351,7 +351,7 @@ keywords_copykeys(struct fitsparams *p, char *inkeys, 
size_t numinkeys)
   if(p->copykeysrange[0]>=numinkeys)
     error(EXIT_FAILURE, 0, "%s (hdu %s): first keyword number give to "
           "`--copykeys' (%ld) is larger than the number of keywords in this "
-          "header (%ld, including the `END' keyword)", p->filename, p->cp.hdu,
+          "header (%zu, including the `END' keyword)", p->filename, p->cp.hdu,
           p->copykeysrange[0], numinkeys);
 
   /* If the user wanted to count from the end (by giving a negative value),
@@ -374,7 +374,7 @@ keywords_copykeys(struct fitsparams *p, char *inkeys, 
size_t numinkeys)
   if(p->copykeysrange[1]>=numinkeys)
     error(EXIT_FAILURE, 0, "%s (hdu %s): second keyword number give to "
           "`--copykeys' (%ld) is larger than the number of keywords in this "
-          "header (%ld, including the `END' keyword)", p->filename, p->cp.hdu,
+          "header (%zu, including the `END' keyword)", p->filename, p->cp.hdu,
           p->copykeysrange[1], numinkeys);
 
 
@@ -424,7 +424,7 @@ keywords_date_to_seconds(struct fitsparams *p, fitsfile 
*fptr)
       printf("(To suppress verbose output, run with `-q')\n");
     }
   else
-    printf("%ld%s\n", seconds, subsecstr);
+    printf("%zu%s\n", seconds, subsecstr);
 }
 
 
diff --git a/bin/match/ui.c b/bin/match/ui.c
index ad97172..43a0ff9 100644
--- a/bin/match/ui.c
+++ b/bin/match/ui.c
@@ -321,7 +321,10 @@ ui_set_mode(struct matchparams *p)
       p->mode = (tin1 == IMAGE_HDU) ? MATCH_MODE_WCS : MATCH_MODE_CATALOG;
     }
   else
-    p->mode=MATCH_MODE_CATALOG;
+    {
+      tin1=ASCII_TBL; /* For "uninitialized" warning, irrelevant here. */
+      p->mode=MATCH_MODE_CATALOG;
+    }
 
 
   /* Necessary sanity checks. */
diff --git a/bin/table/arithmetic.c b/bin/table/arithmetic.c
index 9b74e0a..3ed15dc 100644
--- a/bin/table/arithmetic.c
+++ b/bin/table/arithmetic.c
@@ -187,7 +187,7 @@ arithmetic_init(struct tableparams *p, struct 
arithmetic_token **arith,
   uint8_t ntype;
   char *str, *delimiter=" \t";
   struct arithmetic_token *node=NULL;
-  char *token=NULL, *lasttoken, *saveptr;
+  char *token=NULL, *lasttoken=NULL, *saveptr;
 
   /* Parse all the given tokens. */
   token=strtok_r(expression, delimiter, &saveptr);
@@ -256,9 +256,9 @@ arithmetic_indexs_final(struct tableparams *p, size_t 
*colmatch)
             if(atmp->index!=GAL_BLANK_SIZE_T)
               {
                 /* Small sanity check. */
-                if(colmatch[i]!=1)
-                  error(EXIT_FAILURE, 0, "arithmetic operands can only "
-                        "correspond to a single column");
+                if(colmatch[atmp->index]!=1)
+                  error(EXIT_FAILURE, 0, "arithmetic operands can (currently) "
+                        "only correspond to a single column");
 
                 /* Update the index in the full list of read columns. */
                 numcols=0; for(i=0;i<atmp->index;++i) numcols+=colmatch[i];



reply via email to

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