X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdatasheet.c;h=74da1116a579e539178461917c5561259b557544;hb=7c29c75d1317835e99863a6010c6b7a4b1aeecd1;hp=2847703d1e8f432556ae70a428a167a6ed56599b;hpb=d0f2ab98f2b05a4641cb0d1d042fbe2ad89444aa;p=pspp diff --git a/src/data/datasheet.c b/src/data/datasheet.c index 2847703d1e..74da1116a5 100644 --- a/src/data/datasheet.c +++ b/src/data/datasheet.c @@ -175,7 +175,7 @@ value_to_data (const union value *value_, int width) if (width == 0) return &value->f; else - return value_str_rw (value, width); + return value->s; } /* Returns the number of bytes needed to store all the values in @@ -604,8 +604,8 @@ datasheet_get_value (const struct datasheet *ds, casenumber row, successful, false on I/O error. On failure, ROW might be partially modified or corrupted. */ bool -datasheet_put_value (struct datasheet *ds UNUSED, casenumber row UNUSED, - size_t column UNUSED, const union value *value UNUSED) +datasheet_put_value (struct datasheet *ds, casenumber row, + size_t column, const union value *value) { return rw_case (ds, OP_WRITE, row, column, 1, (union value *) value); } @@ -625,37 +625,37 @@ datasheet_insert_rows (struct datasheet *ds, while (cnt > 0) { unsigned long first_phy; - unsigned long phy_cnt; + unsigned long n_phys; unsigned long i; /* Allocate physical rows from the pool of available rows. */ - if (!axis_allocate (ds->rows, cnt, &first_phy, &phy_cnt)) + if (!axis_allocate (ds->rows, cnt, &first_phy, &n_phys)) { /* No rows were available. Extend the row axis to make some new ones available. */ - phy_cnt = cnt; + n_phys = cnt; first_phy = axis_extend (ds->rows, cnt); } /* Insert the new rows into the row mapping. */ - axis_insert (ds->rows, before, first_phy, phy_cnt); + axis_insert (ds->rows, before, first_phy, n_phys); /* Initialize the new rows. */ - for (i = 0; i < phy_cnt; i++) + for (i = 0; i < n_phys; i++) if (!datasheet_put_row (ds, before + i, c[i])) { while (++i < cnt) case_unref (c[i]); - datasheet_delete_rows (ds, before - added, phy_cnt + added); + datasheet_delete_rows (ds, before - added, n_phys + added); return false; } /* Advance. */ - c += phy_cnt; - cnt -= phy_cnt; - before += phy_cnt; - added += phy_cnt; + c += n_phys; + cnt -= n_phys; + before += n_phys; + added += n_phys; } return true; } @@ -734,10 +734,10 @@ datasheet_reader_destroy (struct casereader *reader UNUSED, void *ds_) /* "advance" function for the datasheet random casereader. */ static void datasheet_reader_advance (struct casereader *reader UNUSED, void *ds_, - casenumber case_cnt) + casenumber n_cases) { struct datasheet *ds = ds_; - datasheet_delete_rows (ds, 0, case_cnt); + datasheet_delete_rows (ds, 0, n_cases); } /* Random casereader class for a datasheet. */ @@ -819,7 +819,7 @@ rw_case (struct datasheet *ds, enum rw_op op, assert (start_column + n_columns <= datasheet_get_n_columns (ds)); prow = axis_map (ds->rows, lrow); - for (i = 0; i < n_columns; ) + for (i = 0; i < n_columns;) { struct source *source = columns[i].source; size_t j;