error:
sfm_close (r_);
- dict_destroy (dict);
+ dict_unref (dict);
*dictp = NULL;
return NULL;
}
int *n_warnings)
{
const int max_warnings = 8;
- uint8_t raw_type = format >> 16;
- uint8_t w = format >> 8;
- uint8_t d = format;
struct fmt_spec f;
- bool ok;
-
- f.w = w;
- f.d = d;
- msg_disable ();
- ok = (fmt_from_io (raw_type, &f.type)
- && fmt_check_output (&f)
- && fmt_check_width_compat (&f, var_get_width (v)));
- msg_enable ();
-
- if (ok)
+ if (fmt_from_u32 (format, var_get_width (v), false, &f))
{
if (which == PRINT_FORMAT)
var_set_print_format (v, &f);
}
number = text_get_token (text, ss_cstr (" "), NULL);
- if (!strcmp (number, "11"))
+ if (!number)
+ sys_warn (r, record->pos,
+ _("Missing label source value "
+ "following `E' at offset %zu in MRSETS record."),
+ text_pos (text));
+ else if (!strcmp (number, "11"))
mrset->label_from_var_label = true;
else if (strcmp (number, "1"))
sys_warn (r, record->pos,
if (text_match (text, ')'))
break;
}
- if (attrs != NULL)
+ if (attrs != NULL && attribute_get_n_values (attr) > 0)
{
if (!attrset_try_add (attrs, attr))
{
struct variable *var = dict_get_var (dict, i);
struct attrset *attrs = var_get_attributes (var);
const struct attribute *attr = attrset_lookup (attrs, "$@Role");
- if (attr != NULL)
+ if (attr != NULL && attribute_get_n_values (attr) > 0)
{
int value = atoi (attribute_get_value (attr, 0));
enum var_role role;
sys_msg (struct sfm_reader *r, off_t offset,
int class, const char *format, va_list args)
{
- struct msg m;
struct string text;
ds_init_empty (&text);
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);
}
if (fstat (fileno (r->file), &s))
{
- sys_error (ME, 0, _("%s: stat failed (%s)."),
+ sys_error (r, 0, _("%s: stat failed (%s)."),
fh_get_file_name (r->fh), strerror (errno));
return false;
}