Suppress GCC 4.7 warnings by changes to code that make it less clear.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Sep 2012 04:18:32 +0000 (21:18 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Sep 2012 04:20:52 +0000 (21:20 -0700)
I'm not entirely happy with these changes, because they make the code
slightly less obvious.  However, it's still not really bad code, and
it's convenient to have a warning-free build.

src/data/por-file-reader.c
src/libpspp/hmapx.c
utilities/pspp-dump-sav.c

index 58d4d03985688b5a39e03872811b0f2038907c6b..e2c06b8be9eab9f108e03615c831e430c605a419 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -540,7 +540,7 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
 {
   static const char empty_string[] = "";
   char *date, *time;
-  const char *product, *author, *subproduct;
+  const char *product, *subproduct;
   int i;
 
   /* Read file. */
@@ -549,7 +549,11 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
   date = read_pool_string (r);
   time = read_pool_string (r);
   product = match (r, '1') ? read_pool_string (r) : empty_string;
-  author = match (r, '2') ? read_pool_string (r) : empty_string;
+  if (match (r, '2'))
+    {
+      /* Skip "author" field. */
+      read_pool_string (r);
+    }
   subproduct = match (r, '3') ? read_pool_string (r) : empty_string;
 
   /* Validate file. */
index 25dabf6eda54184085509a9be4f807eb2714a87e..ca5900c2829c85e10b2647d552141c0a1b69e809 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,10 +51,12 @@ void
 hmapx_clear (struct hmapx *map)
 {
   struct hmapx_node *node, *next;
-  void *data;
 
-  HMAPX_FOR_EACH_SAFE (data, node, next, map)
-    hmapx_delete (map, node);
+  for (node = hmapx_first (map); node; node = next)
+    {
+      next = hmapx_next (map, node);
+      hmapx_delete (map, node);
+    }
 }
 
 /* Allocates and returns a new hmapx_node with DATA as its data
index 54e4712b589830f548b8d2efbeeb4eb75097cbe3..a3aad0bf249ff7cebc21b7e8ff75905b48041e64 100644 (file)
@@ -227,7 +227,6 @@ read_header (struct sfm_reader *r)
   char eye_catcher[61];
   uint8_t raw_layout_code[4];
   int32_t layout_code;
-  int32_t nominal_case_size;
   int32_t compressed;
   int32_t weight_index;
   int32_t ncases;
@@ -254,7 +253,7 @@ read_header (struct sfm_reader *r)
   layout_code = integer_get (r->integer_format,
                              raw_layout_code, sizeof raw_layout_code);
 
-  nominal_case_size = read_int (r);
+  read_int (r);                 /* Nominal case size (not actually useful). */
   compressed = read_int (r);
   weight_index = read_int (r);
   ncases = read_int (r);