/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010 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
const struct caseproto *
datasheet_get_proto (const struct datasheet *ds_)
{
- struct datasheet *ds = (struct datasheet *) ds_;
+ struct datasheet *ds = CONST_CAST (struct datasheet *, ds_);
if (ds->proto == NULL)
{
size_t i;
{
struct column *col;
+ assert (before <= ds->n_columns);
+
ds->columns = xnrealloc (ds->columns,
ds->n_columns + 1, sizeof *ds->columns);
insert_element (ds->columns, ds->n_columns, sizeof *ds->columns, before);
void
datasheet_delete_columns (struct datasheet *ds, size_t start, size_t n)
{
+ assert (start + n <= ds->n_columns);
+
if (n > 0)
{
size_t i;
size_t old_start, size_t new_start,
size_t n)
{
+ assert (old_start + n <= ds->n_columns);
+ assert (new_start + n <= ds->n_columns);
+
move_range (ds->columns, ds->n_columns, sizeof *ds->columns,
old_start, new_start, n);
{
size_t n_columns = datasheet_get_n_columns (ds);
struct ccase *c = case_create (datasheet_get_proto (ds));
- if (rw_case ((struct datasheet *) ds, OP_READ,
+ if (rw_case (CONST_CAST (struct datasheet *, ds), OP_READ,
row, 0, n_columns, case_data_all_rw (c)))
return c;
else
size_t column, union value *value)
{
assert (row >= 0);
- return rw_case ((struct datasheet *) ds, OP_READ, row, column, 1, value);
+ return rw_case (CONST_CAST (struct datasheet *, ds), OP_READ,
+ row, column, 1, value);
}
/* Stores VALUE into DS in the given ROW and COLUMN. VALUE must