bug-findutils
[Top][All Lists]
Advanced

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

[PATCH 6/8] locate: Fix compiler warnings.


From: James Youngman
Subject: [PATCH 6/8] locate: Fix compiler warnings.
Date: Sat, 2 Jan 2016 23:54:56 +0000

* locate/word_io.c (decode_value): Fix typo in comment.
(getword): Remove unused parameter minvalue.
* locate/locatedb.h: Adjust declaration of decode_value to remove
minvalue parameter.
* locate/locate.c: Declare dolocate().  Make that function static.
(visit_old_format): Don't pass a minvalue parameter to getword()
since it no longer wants it.
---
 locate/locate.c   | 7 ++++---
 locate/locatedb.h | 2 +-
 locate/word_io.c  | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/locate/locate.c b/locate/locate.c
index 7954895..d406978 100644
--- a/locate/locate.c
+++ b/locate/locate.c
@@ -161,6 +161,7 @@ static bool results_were_filtered;
 
 static const char *selected_secure_db = NULL;
 
+static int dolocate (int argc, char **argv, int secure_db_fd);
 
 /* Change the number of days old the database can be
  * before we complain about it.
@@ -492,7 +493,8 @@ visit_old_format (struct process_data *procdata, void 
*context)
       else
         maxval = (procdata->len - 0);
       word = getword (procdata->fp, procdata->dbfile,
-                      minval, maxval, &procdata->endian_state);
+                      maxval, &procdata->endian_state);
+      assert (word >= minval);
       procdata->count += word;
       assert (procdata->count >= 0);
     }
@@ -1543,7 +1545,7 @@ cleanup_quote_opts (void)
 }
 
 
-int
+static int
 dolocate (int argc, char **argv, int secure_db_fd)
 {
   char *path_element = NULL;
@@ -1922,7 +1924,6 @@ dolocate (int argc, char **argv, int secure_db_fd)
     return 1;
 }
 
-#define ARRAYSIZE(a) (sizeof (a)/sizeof (a[0]))
 static int
 open_secure_db (void)
 {
diff --git a/locate/locatedb.h b/locate/locatedb.h
index 048a2ea..bc19ddb 100644
--- a/locate/locatedb.h
+++ b/locate/locatedb.h
@@ -60,7 +60,7 @@ typedef enum
   } GetwordEndianState;
 
 int getword (FILE *fp, const char *filename,
-            size_t minvalue, size_t maxvalue,
+            size_t maxvalue,
             GetwordEndianState *endian_state_flag);
 
 bool putword (FILE *fp, int word,
diff --git a/locate/word_io.c b/locate/word_io.c
index 40a1890..743780d 100644
--- a/locate/word_io.c
+++ b/locate/word_io.c
@@ -71,7 +71,7 @@ decode_value (const unsigned char data[],
            {
              /* the native value is inside the limit and the
               * swapped value is not.  We take this as proof
-              * that we should be using the ative byte order.
+              * that we should be using the native byte order.
               */
              *endian_state_flag = GetwordEndianStateNative;
            }
@@ -113,7 +113,6 @@ decode_value (const unsigned char data[],
 int
 getword (FILE *fp,
         const char *filename,
-        size_t minvalue,
         size_t maxvalue,
         GetwordEndianState *endian_state_flag)
 {
-- 
2.1.4




reply via email to

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