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 <config.h>
#include "pfm-read.h"
getl_location (&e.where.filename, &e.where.line_number);
filename = handle_get_filename (r->fh);
e.title = title = pool_alloc (r->pool, strlen (filename) + 80);
- sprintf (e.title, _("portable file %s corrupt at offset %ld: "),
+ sprintf (title, _("portable file %s corrupt at offset %ld: "),
filename, ftell (r->file));
va_start (args, msg);
/* Skip and verify signature. */
for (i = 0; i < 8; i++)
- if (!match (r, "SPSSPORT"[i]))
- error (r, _("Missing SPSSPORT signature."));
+ if (!match (r, "SPSSPORT"[i]))
+ {
+ msg (SE, _("%s: Not a portable file."), handle_get_filename (r->fh));
+ longjmp (r->bail_out, 1);
+ }
}
/* Reads the version and date info record, as well as product and
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. */
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 *) "";
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);
}
}
if (match (r, '6'))
{
weight_name = read_pool_string (r);
- if (strlen (weight_name) > 8)
+ if (strlen (weight_name) > SHORT_NAME_LEN)
error (r, _("Weight variable name (%s) truncated."), weight_name);
}
for (j = 0; j < 6; j++)
fmt[j] = read_int (r);
- if (!var_is_valid_name (name, false) || *name == '#')
+ if (!var_is_valid_name (name, false) || *name == '#' || *name == '$')
error (r, _("position %d: Invalid variable name `%s'."), name);
- st_uppercase (name);
+ str_uppercase (name);
if (width < 0 || width > 255)
error (r, "Bad width %d for variable %s.", width, name);
{
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);
{
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);
}
}