From: Ben Pfaff Date: Tue, 26 May 2009 03:21:08 +0000 (-0700) Subject: Fix portable file reader use of long strings. X-Git-Tag: v0.7.3~73 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f10847d456fff212f0b3e602f7d6b57512f4830;p=pspp-builds.git Fix portable file reader use of long strings. This code hadn't been converted to the new "union value" representation, where a single "union value" always represents a whole data item. This commit fixes that. --- diff --git a/src/data/por-file-reader.c b/src/data/por-file-reader.c index 96af30b1..461796bf 100644 --- a/src/data/por-file-reader.c +++ b/src/data/por-file-reader.c @@ -819,7 +819,6 @@ por_file_casereader_read (struct casereader *reader, void *r_) struct pfm_reader *r = r_; struct ccase *volatile c; size_t i; - size_t idx; c = case_create (r->proto); setjmp (r->bail_out); @@ -837,22 +836,17 @@ por_file_casereader_read (struct casereader *reader, void *r_) return NULL; } - idx = 0; for (i = 0; i < r->var_cnt; i++) { int width = caseproto_get_width (r->proto, i); if (width == 0) - { - case_data_rw_idx (c, idx)->f = read_float (r); - idx++; - } + case_data_rw_idx (c, i)->f = read_float (r); else { char string[256]; read_string (r, string); - buf_copy_str_rpad (case_str_rw_idx (c, idx), width, string, ' '); - idx += DIV_RND_UP (width, MAX_SHORT_STRING); + buf_copy_str_rpad (case_str_rw_idx (c, i), width, string, ' '); } }