/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-2000, 2006-2007, 2009-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2006-2007, 2009-2016 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
/* Fetch file size. */
if (fstat (fileno (r->file), &s))
{
- pcp_error (ME, 0, _("%s: stat failed (%s)."),
+ pcp_error (r, 0, _("%s: stat failed (%s)."),
fh_get_file_name (r->fh), strerror (errno));
goto error;
}
if (s.st_size > UINT_MAX)
{
- pcp_error (ME, 0, _("%s: file too large."), fh_get_file_name (r->fh));
+ pcp_error (r, 0, _("%s: file too large."), fh_get_file_name (r->fh));
goto error;
}
r->file_size = s.st_size;
error:
pcp_close (&r->any_reader);
- dict_destroy (dict);
+ dict_unref (dict);
*dictp = NULL;
return NULL;
}
uint8_t len;
if (var->n_val_labs >= allocated_val_labs)
- var->val_labs = x2nrealloc (var->val_labs, &allocated_val_labs,
- sizeof *var->val_labs);
+ var->val_labs = pool_2nrealloc (r->pool, var->val_labs,
+ &allocated_val_labs,
+ sizeof *var->val_labs);
vl = &var->val_labs[var->n_val_labs];
if (!read_bytes (r, vl->value, sizeof vl->value)
if (var_is_numeric (var))
value.f = parse_float (rec->val_labs[i].value);
else
- memcpy (value_str_rw (&value, rec->width),
- rec->val_labs[i].value, rec->width);
+ memcpy (value.s, rec->val_labs[i].value, rec->width);
utf8_label = recode_string ("UTF-8", dict_encoding,
rec->val_labs[i].label, -1);
if (var->width == 0)
retval = read_case_number (r, &v->f);
else
- retval = read_case_string (r, value_str_rw (v, var->width),
- var->width);
+ retval = read_case_string (r, v->s, var->width);
if (retval != 1)
{
pcp_msg (struct pcp_reader *r, off_t offset,
int class, const char *format, va_list args)
{
- struct msg m;
struct string text;
-
ds_init_empty (&text);
if (offset >= 0)
ds_put_format (&text, _("`%s' near offset 0x%llx: "),
ds_put_format (&text, _("`%s': "), fh_get_file_name (r->fh));
ds_put_vformat (&text, format, args);
- m.category = msg_class_to_category (class);
- m.severity = msg_class_to_severity (class);
- m.file_name = NULL;
- m.first_line = 0;
- m.last_line = 0;
- m.first_column = 0;
- m.last_column = 0;
- m.text = ds_cstr (&text);
-
+ struct msg m = {
+ .category = msg_class_to_category (class),
+ .severity = msg_class_to_severity (class),
+ .text = ds_cstr (&text),
+ };
msg_emit (&m);
}