Corrected logical errors in tests for error conditions.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 25 Oct 2013 19:00:44 +0000 (21:00 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 25 Oct 2013 19:00:44 +0000 (21:00 +0200)
Fixed several places where && had bee used where || was intended
and vici-versa.

Reported-By: David Binderman <dcb314@hotmail.com>
src/data/data-in.c
src/language/lexer/q2c.c
src/language/stats/glm.c
src/ui/gui/psppire-var-sheet.c

index db99aa4fb896d9d8f99657b2e7c6caf41940948e..ace167090c57b9f2f2fe97a4d4e96cd80405764d 100644 (file)
@@ -919,7 +919,7 @@ parse_year (struct data_in *i, long *year, size_t max_digits)
       else
         *year += epoch_century + 100;
     }
-  if (*year >= 1582 || *year <= 19999)
+  if (*year >= 1582 && *year <= 19999)
     return NULL;
 
   return xasprintf (_("Year (%ld) must be between 1582 and 19999."), *year);
index 20bdd564969adf24c05caf83d82e5104cf1f3f9c..27ff530d318eb9c364ba7db5d59fb8e99c13cc4a 100644 (file)
@@ -1729,7 +1729,7 @@ dump_parser (int persistent)
   dump (0, "static int");
   dump (0, "parse_%s (struct lexer *lexer, struct dataset *ds%s, struct cmd_%s *p, void *aux UNUSED)",
         make_identifier (cmdname),
-       (def && ( def->type == SBC_VARLIST && def->type == SBC_CUSTOM))?"":" UNUSED",
+       (def && ( def->type == SBC_VARLIST || def->type == SBC_CUSTOM))?"":" UNUSED",
        make_identifier (cmdname));
   dump (1, "{");
 
index 82ca9896e1a050828763c7362480a9881ceec96e..13d878176e975dd3f30f51ecc34152631b1b0ae8 100644 (file)
@@ -267,7 +267,7 @@ cmd_glm (struct lexer *lexer, struct dataset *ds)
            }
 
          glm.ss_type = lex_integer (lexer);
-         if (1 > glm.ss_type  && 3 < glm.ss_type )
+         if (1 > glm.ss_type  ||  3 < glm.ss_type )
            {
              msg (ME, _("Only types 1, 2 & 3 sums of squares are currently implemented"));
              goto error;
index bb2c56ba7aa9ee27257cf2470b57d2efe53fee19..a6817480865758ca3f478e775fa49a44e3286a65 100644 (file)
@@ -591,7 +591,7 @@ get_string_width (PsppSheetView *treeview, GtkCellRenderer *renderer,
 }
 
 static gint
-get_monospace_width (PsppSheetView *treeview, GtkCellRenderer *renderer,
+get_monospac_width (PsppSheetView *treeview, GtkCellRenderer *renderer,
                      size_t char_cnt)
 {
   struct string s;