static int
corrupt_msg (struct pfm_reader *r, const char *format, ...)
{
- char buf[1024];
-
- {
- va_list args;
+ char *title;
+ struct error e;
+ const char *filename;
+ va_list args;
- va_start (args, format);
- vsnprintf (buf, 1024, format, args);
- va_end (args);
- }
-
- {
- char *title;
- struct error e;
- const char *filename;
+ e.class = ME;
+ getl_location (&e.where.filename, &e.where.line_number);
+ filename = handle_get_filename (r->fh);
+ e.title = title = local_alloc (strlen (filename) + 80);
+ sprintf (title, _("portable file %s corrupt at offset %ld: "),
+ filename, ftell (r->file) - (82 - (long) (r->bp - r->buf)));
- e.class = ME;
- getl_location (&e.where.filename, &e.where.line_number);
- filename = handle_get_filename (r->fh);
- e.title = title = local_alloc (strlen (filename) + 80);
- sprintf (title, _("portable file %s corrupt at offset %ld: "),
- filename, ftell (r->file) - (82 - (long) (r->bp - r->buf)));
- e.text = buf;
+ va_start (args, format);
+ err_vmsg (&e, format, args);
+ va_end (args);
- err_vmsg (&e);
+ local_free (title);
- local_free (title);
- }
-
return 0;
}
+static unsigned char * read_string (struct pfm_reader *r);
+
/* Closes a portable file after we're done with it. */
void
pfm_close_reader (struct pfm_reader *r)
if (r == NULL)
return;
+ read_string (NULL);
+
if (r->fh != NULL)
fh_close (r->fh, "portable file", "rs");
if (fclose (r->file) == EOF)
msg (ME, _("%s: Closing portable file: %s."),
handle_get_filename (r->fh), strerror (errno));
free (r->trans);
+ free (r->widths);
free (r);
}
lose ((r, "Bad width %d for variable %s.", width, name));
v = dict_create_var (dict, name, width);
- v->aux = xmalloc (sizeof (int));
- *(int *) v->aux = v->fv;
if (v == NULL)
lose ((r, _("Duplicate variable name %s."), name));
if (!convert_format (r, &fmt[0], &v->print, v))