X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fpfm-read.c;h=4d95eba22ae3a05b7ff716c3d7dfb96c9fcb2025;hb=c434e369b6695f8135a2914e9a425edcdd09ef35;hp=d55f2f6e8c2174b8bd52a7222f82626ef1293a46;hpb=05e356b2a3087e819ef3b5388e29c822f41502e1;p=pspp diff --git a/src/pfm-read.c b/src/pfm-read.c index d55f2f6e8c..4d95eba22a 100644 --- a/src/pfm-read.c +++ b/src/pfm-read.c @@ -16,8 +16,8 @@ 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., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "pfm-read.h" @@ -408,7 +408,7 @@ read_header (struct pfm_reader *r) static void read_version_data (struct pfm_reader *r, struct pfm_read_info *info) { - char *date, *time, *product, *subproduct; + char *date, *time, *product, *author, *subproduct; int i; /* Read file. */ @@ -417,6 +417,7 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info) date = read_pool_string (r); time = read_pool_string (r); product = match (r, '1') ? read_pool_string (r) : (unsigned char *) ""; + author = match (r, '2') ? read_pool_string (r) : (unsigned char *) ""; subproduct = match (r, '3') ? read_pool_string (r) : (unsigned char *) ""; @@ -448,8 +449,8 @@ read_version_data (struct pfm_reader *r, struct pfm_read_info *info) info->creation_time[8] = 0; /* Product. */ - st_trim_copy (info->product, product, sizeof info->product); - st_trim_copy (info->subproduct, subproduct, sizeof info->subproduct); + str_copy_trunc (info->product, sizeof info->product, product); + str_copy_trunc (info->subproduct, sizeof info->subproduct, subproduct); } } @@ -520,32 +521,10 @@ read_variables (struct pfm_reader *r, struct dictionary *dict) read_string (r, name); for (j = 0; j < 6; j++) fmt[j] = read_int (r); -#if 0 - /* Weirdly enough, there is no # character in the SPSS portable - character set, so we can't check for it. */ - if (strlen (name) > SHORT_NAME_LEN) - lose ((r, _("position %d: Variable name has %u characters."), - i, strlen (name))); - if ((name[0] < 74 /* A */ || name[0] > 125 /* Z */) - && name[0] != 152 /* @ */) - lose ((r, _("position %d: Variable name begins with invalid " - "character."), i)); - if (name[0] >= 100 /* a */ && name[0] <= 125 /* z */) - { - corrupt_msg (r, _("position %d: Variable name begins with " - "lowercase letter %c."), - i, name[0] - 100 + 'a'); - name[0] -= 26 /* a - A */; - } - /* Verify remaining characters of variable name. */ - for (j = 1; j < (int) strlen (name); j++) - { - int c = name[j]; -#endif - if (!var_is_valid_name (name, false) || *name == '#') - error (r, _("position %d: Invalid variable name `%s'."), name); - st_uppercase (name); + if (!var_is_valid_name (name, false) || *name == '#' || *name == '$') + error (r, _("position %d: Invalid variable name `%s'."), i, name); + str_uppercase (name); if (width < 0 || width > 255) error (r, "Bad width %d for variable %s.", width, name); @@ -627,7 +606,7 @@ parse_value (struct pfm_reader *r, struct variable *vv) { char string[256]; read_string (r, string); - st_bare_pad_copy (v.s, string, 8); + buf_copy_str_rpad (v.s, 8, string); } else v.f = read_float (r); @@ -721,7 +700,7 @@ pfm_read_case (struct pfm_reader *r, struct ccase *c) { char string[256]; read_string (r, string); - st_bare_pad_copy (case_data_rw (c, idx)->s, string, width); + buf_copy_str_rpad (case_data_rw (c, idx)->s, width, string); idx += DIV_RND_UP (width, MAX_SHORT_STRING); } }