projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
str: Change "char" to "byte" in function names.
[pspp]
/
src
/
ui
/
gui
/
text-data-import-dialog.c
diff --git
a/src/ui/gui/text-data-import-dialog.c
b/src/ui/gui/text-data-import-dialog.c
index 070c4f6b3cd3b05b3428994cb307326463599a6c..4db2d8ca6fe88432c9872ced331c281fd29a211e 100644
(file)
--- a/
src/ui/gui/text-data-import-dialog.c
+++ b/
src/ui/gui/text-data-import-dialog.c
@@
-338,7
+338,7
@@
apply_dict (const struct dictionary *dict, struct string *s)
const struct val_lab *vl = labels[i];
ds_put_cstr (s, "\n ");
syntax_gen_value (s, &vl->value, width, format);
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);
syntax_gen_string (s, ss_cstr (val_lab_get_label (vl)));
}
free (labels);
@@
-398,9
+398,9
@@
generate_syntax (const struct import_assistant *ia)
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 (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");
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++)
{
ds_put_cstr (&s, "\\\\");
for (i = 0; i < ds_length (&ia->separators.separators); i++)
{
@@
-408,7
+408,7
@@
generate_syntax (const struct import_assistant *ia)
if (c == '"')
ds_put_cstr (&s, "\"\"");
else if (c != '\t' && c != '\\')
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))
}
ds_put_cstr (&s, "\"\n");
if (!ds_is_empty (&ia->separators.quotes))
@@
-1169,7
+1169,7
@@
split_fields (struct import_assistant *ia)
clear_fields (ia);
/* Is space in the set of separators? */
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
/* Split all the lines, not just those from
ia->first_line.skip_lines on, so that we split the line that
@@
-1196,9
+1196,9
@@
split_fields (struct import_assistant *ia)
field = text;
}
else if (!ds_is_empty (&s->quotes)
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
if (!s->escape)
ss_get_until (&text, quote, &field);
else
@@
-1207,18
+1207,18
@@
split_fields (struct import_assistant *ia)
int c;
ds_init_empty (&s);
int c;
ds_init_empty (&s);
- while ((c = ss_get_
char
(&text)) != EOF)
+ while ((c = ss_get_
byte
(&text)) != EOF)
if (c != quote)
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
else
break;
field = ds_ss (&s);
}
}
else
- ss_get_
char
s (&text, ss_cspan (text, ds_ss (&s->separators)),
+ ss_get_
byte
s (&text, ss_cspan (text, ds_ss (&s->separators)),
&field);
if (column_idx >= s->column_cnt)
&field);
if (column_idx >= s->column_cnt)
@@
-1243,7
+1243,7
@@
split_fields (struct import_assistant *ia)
ss_ltrim (&text, ss_cstr (" "));
if (ss_is_empty (text))
break;
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);
}
!= SIZE_MAX)
ss_advance (&text, 1);
}
@@
-1331,7
+1331,7
@@
find_commonest_chars (unsigned long int histogram[UCHAR_MAX + 1],
if (max_count > 0)
{
ds_clear (result);
if (max_count > 0)
{
ds_clear (result);
- ds_put_
char
(result, max);
+ ds_put_
byte
(result, max);
}
else
ds_assign_cstr (result, def);
}
else
ds_assign_cstr (result, def);
@@
-1387,7
+1387,7
@@
set_separators (struct import_assistant *ia)
}
}
}
}
- ds_put_
char
(&custom, c);
+ ds_put_
byte
(&custom, c);
next:;
}
next:;
}
@@
-1430,7
+1430,7
@@
get_separators (struct import_assistant *ia)
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)))
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)))
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s->custom_cb)))
@@
-1775,19
+1775,19
@@
parse_field (struct import_assistant *ia,
tooltip = NULL;
if (field.string != NULL)
{
tooltip = NULL;
if (field.string != NULL)
{
-
msg_disable ()
;
+
char *error
;
- if (!data_in (field, LEGACY_NATIVE, in->type, 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,
(int) field.length, field.string,
- fmt_string);
+ fmt_name (in->type), error);
+ free (error);
}
}
- msg_enable ();
}
else
{
}
else
{
@@
-1952,8
+1952,8
@@
get_monospace_width (GtkTreeView *treeview, GtkCellRenderer *renderer,
gint width;
ds_init_empty (&s);
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);
width = get_string_width (treeview, renderer, ds_cstr (&s));
ds_destroy (&s);