const struct val_lab *vl = labels[i];
ds_put_cstr (s, "\n ");
syntax_gen_value (s, &vl->value, width, format);
- ds_put_char (s, ' ');
+ ds_put_byte (s, ' ');
syntax_gen_string (s, ss_cstr (val_lab_get_label (vl)));
}
free (labels);
if (ia->first_line.skip_lines > 0)
ds_put_format (&s, " /FIRSTCASE=%d\n", ia->first_line.skip_lines + 1);
ds_put_cstr (&s, " /DELIMITERS=\"");
- if (ds_find_char (&ia->separators.separators, '\t') != SIZE_MAX)
+ if (ds_find_byte (&ia->separators.separators, '\t') != SIZE_MAX)
ds_put_cstr (&s, "\\t");
- if (ds_find_char (&ia->separators.separators, '\\') != SIZE_MAX)
+ if (ds_find_byte (&ia->separators.separators, '\\') != SIZE_MAX)
ds_put_cstr (&s, "\\\\");
for (i = 0; i < ds_length (&ia->separators.separators); i++)
{
if (c == '"')
ds_put_cstr (&s, "\"\"");
else if (c != '\t' && c != '\\')
- ds_put_char (&s, c);
+ ds_put_byte (&s, c);
}
ds_put_cstr (&s, "\"\n");
if (!ds_is_empty (&ia->separators.quotes))
stream = fopen (file->file_name, "r");
if (stream == NULL)
{
- msg (ME, _("Could not open \"%s\": %s"),
+ msg (ME, _("Could not open `%s': %s"),
file->file_name, strerror (errno));
return false;
}
if (feof (stream))
break;
else if (ferror (stream))
- msg (ME, _("Error reading \"%s\": %s"),
+ msg (ME, _("Error reading `%s': %s"),
file->file_name, strerror (errno));
else
- msg (ME, _("Failed to read \"%s\", because it contains a line "
+ msg (ME, _("Failed to read `%s', because it contains a line "
"over %d bytes long and therefore appears not to be "
"a text file."),
file->file_name, MAX_LINE_LEN);
if (file->line_cnt == 0)
{
- msg (ME, _("\"%s\" is empty."), file->file_name);
+ msg (ME, _("`%s' is empty."), file->file_name);
fclose (stream);
destroy_file (ia);
return false;
clear_fields (ia);
/* Is space in the set of separators? */
- space_sep = ss_find_char (ds_ss (&s->separators), ' ') != SIZE_MAX;
+ space_sep = ss_find_byte (ds_ss (&s->separators), ' ') != SIZE_MAX;
/* Split all the lines, not just those from
ia->first_line.skip_lines on, so that we split the line that
field = text;
}
else if (!ds_is_empty (&s->quotes)
- && ds_find_char (&s->quotes, text.string[0]) != SIZE_MAX)
+ && ds_find_byte (&s->quotes, text.string[0]) != SIZE_MAX)
{
- int quote = ss_get_char (&text);
+ int quote = ss_get_byte (&text);
if (!s->escape)
ss_get_until (&text, quote, &field);
else
int c;
ds_init_empty (&s);
- while ((c = ss_get_char (&text)) != EOF)
+ while ((c = ss_get_byte (&text)) != EOF)
if (c != quote)
- ds_put_char (&s, c);
- else if (ss_match_char (&text, quote))
- ds_put_char (&s, quote);
+ ds_put_byte (&s, c);
+ else if (ss_match_byte (&text, quote))
+ ds_put_byte (&s, quote);
else
break;
field = ds_ss (&s);
}
}
else
- ss_get_chars (&text, ss_cspan (text, ds_ss (&s->separators)),
+ ss_get_bytes (&text, ss_cspan (text, ds_ss (&s->separators)),
&field);
if (column_idx >= s->column_cnt)
ss_ltrim (&text, ss_cstr (" "));
if (ss_is_empty (text))
break;
- if (ss_find_char (ds_ss (&s->separators), ss_first (text))
+ if (ss_find_byte (ds_ss (&s->separators), ss_first (text))
!= SIZE_MAX)
ss_advance (&text, 1);
}
if (max_count > 0)
{
ds_clear (result);
- ds_put_char (result, max);
+ ds_put_byte (result, max);
}
else
ds_assign_cstr (result, def);
}
}
- ds_put_char (&custom, c);
+ ds_put_byte (&custom, c);
next:;
}
const struct separator *sep = &separators[i];
GtkWidget *button = get_widget_assert (ia->asst.builder, sep->name);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
- ds_put_char (&s->separators, sep->c);
+ ds_put_byte (&s->separators, sep->c);
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s->custom_cb)))
tooltip = NULL;
if (field.string != NULL)
{
- msg_disable ();
+ char *error;
- if (!data_in (field, LEGACY_NATIVE, in->type, 0, 0, 0,
- ia->formats.dict,
- &val, var_get_width (var)))
+ error = data_in (field, LEGACY_NATIVE, in->type, &val,
+ var_get_width (var),
+ dict_get_encoding (ia->formats.dict));
+ if (error != NULL)
{
- char fmt_string[FMT_STRING_LEN_MAX + 1];
- fmt_to_string (in, fmt_string);
- tooltip = xasprintf (_("Field content \"%.*s\" cannot be parsed in "
- "format %s."),
+ tooltip = xasprintf (_("Cannot parse field content `%.*s' as "
+ "format %s: %s"),
(int) field.length, field.string,
- fmt_string);
+ fmt_name (in->type), error);
+ free (error);
}
- msg_enable ();
}
else
{
gint width;
ds_init_empty (&s);
- ds_put_char_multiple (&s, '0', char_cnt);
- ds_put_char (&s, ' ');
+ ds_put_byte_multiple (&s, '0', char_cnt);
+ ds_put_byte (&s, ' ');
width = get_string_width (treeview, renderer, ds_cstr (&s));
ds_destroy (&s);