Bug #21111. Reviewed by John Darrington.
[pspp-builds.git] / src / language / data-io / data-list.c
index d2ca99185833c745cbb3daff0763fd9244a7a470..4e2f083bee9077f2f69c990624fc6694b8ed0749 100644 (file)
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
    Copyright (C) 1997-9, 2000, 2006 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 the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
 
@@ -685,9 +683,15 @@ read_from_data_list_fixed (const struct data_list_pgm *dls, struct ccase *c)
       line = dfm_get_record (dls->reader);
 
       ll_for_each_continue (spec, struct dls_var_spec, ll, &dls->specs)
-        data_in (ss_substr (line, spec->first_column - 1, spec->input.w),
-                 spec->input.type, spec->input.d, spec->first_column,
-                 case_data_rw_idx (c, spec->fv), fmt_var_width (&spec->input));
+        {
+          if (row < spec->record)
+            break;
+
+          data_in (ss_substr (line, spec->first_column - 1, spec->input.w),
+                   spec->input.type, spec->input.d, spec->first_column,
+                   case_data_rw_idx (c, spec->fv),
+                   fmt_var_width (&spec->input));
+        }
 
       dfm_forward_record (dls->reader);
     }
@@ -803,10 +807,10 @@ data_list_trns_proc (void *dls_, struct ccase *c, casenumber case_num UNUSED)
   if (dls->end != NULL)
     {
       double *end = &case_data_rw (c, dls->end)->f;
-      if (retval == TRNS_DROP_CASE)
+      if (retval == TRNS_END_FILE)
         {
           *end = 1.0;
-          retval = TRNS_END_FILE;
+          retval = TRNS_CONTINUE;
         }
       else
         *end = 0.0;