X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdissect-sysfile.c;h=7ae92bfc57c575939b8865ac1c5b09f2c2422a7c;hb=refs%2Fbuilds%2F20110510030502%2Fpspp;hp=cbe1f3a0507fdd8c1de2dff0850ec70c33671b21;hpb=173d1687aea88e0e5e1b1d8615ed68ebefb15d08;p=pspp diff --git a/tests/dissect-sysfile.c b/tests/dissect-sysfile.c index cbe1f3a050..7ae92bfc57 100644 --- a/tests/dissect-sysfile.c +++ b/tests/dissect-sysfile.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010, 2011 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 @@ -36,7 +36,7 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -#define VAR_NAME_LEN 64 +#define ID_MAX_LEN 64 struct sfm_reader { @@ -689,8 +689,8 @@ read_mrsets (struct sfm_reader *r, size_t size, size_t count) if (!text_match (text, ' ')) { - sys_warn (r, _("Missing space following 'E' at offset %zu " - "in MRSETS record"), text_pos (text)); + sys_warn (r, _("Missing space following `%c' at offset %zu " + "in MRSETS record"), 'E', text_pos (text)); break; } @@ -699,13 +699,13 @@ read_mrsets (struct sfm_reader *r, size_t size, size_t count) label_from_var_label = true; else if (strcmp (number, "1")) sys_warn (r, _("Unexpected label source value `%s' " - "following 'E' at offset %zu in MRSETS record"), + "following `E' at offset %zu in MRSETS record"), number, text_pos (text)); } else { - sys_warn (r, "missing 'C', 'D', or 'E' at offset %zu " + sys_warn (r, "missing `C', `D', or `E' at offset %zu " "in mrsets record", text_pos (text)); break; } @@ -925,7 +925,7 @@ read_long_string_value_labels (struct sfm_reader *r, size_t size, size_t count) while (ftello (r->file) - start < size * count) { long long posn = ftello (r->file); - char var_name[VAR_NAME_LEN + 1]; + char var_name[ID_MAX_LEN + 1]; int var_name_len; int n_values; int width; @@ -933,10 +933,10 @@ read_long_string_value_labels (struct sfm_reader *r, size_t size, size_t count) /* Read variable name. */ var_name_len = read_int (r); - if (var_name_len > VAR_NAME_LEN) + if (var_name_len > ID_MAX_LEN) sys_error (r, _("Variable name length in long string value label " "record (%d) exceeds %d-byte limit."), - var_name_len, VAR_NAME_LEN); + var_name_len, ID_MAX_LEN); read_string (r, var_name, var_name_len + 1); /* Read width, number of values. */ @@ -1202,7 +1202,7 @@ text_tokenize (struct text_record *text, int delimiter) && text->buffer[text->pos] != delimiter && text->buffer[text->pos] != '\0') text->pos++; - if (text->pos == text->size) + if (start == text->pos) return NULL; text->buffer[text->pos++] = '\0'; return &text->buffer[start];