X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdatasheet.c;h=f76b1908d50f1dbdeeff94af7f9d6ecd2150ca16;hb=d22c3971e926ceaf62416c6482fe0fb1dc5407f0;hp=63db4f36d38356293cd93d60b8e40db7408f3519;hpb=c532b2e8445401a2613391cda5ab485f9055b484;p=pspp-builds.git diff --git a/src/data/datasheet.c b/src/data/datasheet.c index 63db4f36..f76b1908 100644 --- a/src/data/datasheet.c +++ b/src/data/datasheet.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2007 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 . */ #include @@ -150,8 +148,7 @@ static bool rw_case (struct datasheet *ds, enum rw_op op, /* Creates and returns a new datasheet. If READER is nonnull, then the datasheet initially contains - the contents of READER. READER become owned by the datasheet - and the caller must not directly reference it again. */ + the contents of READER. */ struct datasheet * datasheet_create (struct casereader *reader) { @@ -357,6 +354,8 @@ datasheet_delete_columns (struct datasheet *ds, size_t start, size_t cnt) { size_t lcol; + assert ( start + cnt <= axis_get_size (ds->columns) ); + /* Free up columns for reuse. */ for (lcol = start; lcol < start + cnt; lcol++) { @@ -429,6 +428,7 @@ bool datasheet_get_value (const struct datasheet *ds, casenumber row, size_t column, union value *value, int width) { + assert ( row >= 0 ); return rw_case ((struct datasheet *) ds, OP_READ, row, column, value_cnt_from_width (width), value); }