projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i18n: Introduce C_ENCODING as replacement for LEGACY_NATIVE.
[pspp-builds.git]
/
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 562f4f2a54fc41197618836aa2aa0b958a3766a4..e5c48fdb217c83684c640520bd993f2d4a20e4b9 100644
(file)
--- a/
src/ui/gui/text-data-import-dialog.c
+++ b/
src/ui/gui/text-data-import-dialog.c
@@
-32,6
+32,7
@@
#include "language/data-io/data-parser.h"
#include "language/lexer/lexer.h"
#include "libpspp/assertion.h"
#include "language/data-io/data-parser.h"
#include "language/lexer/lexer.h"
#include "libpspp/assertion.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "ui/gui/checkbox-treeview.h"
#include "ui/gui/descriptives-dialog.h"
#include "libpspp/message.h"
#include "ui/gui/checkbox-treeview.h"
#include "ui/gui/descriptives-dialog.h"
@@
-225,7
+226,7
@@
static GtkTreeViewColumn *make_data_column (struct import_assistant *,
gint column_idx);
static GtkTreeView *create_data_tree_view (bool input, GtkContainer *parent,
struct import_assistant *);
gint column_idx);
static GtkTreeView *create_data_tree_view (bool input, GtkContainer *parent,
struct import_assistant *);
-static
void escape_underscores (const char *in, char *out
);
+static
char *escape_underscores (const char *in
);
static void push_watch_cursor (struct import_assistant *);
static void pop_watch_cursor (struct import_assistant *);
static void push_watch_cursor (struct import_assistant *);
static void pop_watch_cursor (struct import_assistant *);
@@
-1768,8
+1769,7
@@
parse_field (struct import_assistant *ia,
{
char *error;
{
char *error;
- error = data_in (field, LEGACY_NATIVE, in->type, &val,
- var_get_width (var),
+ error = data_in (field, C_ENCODING, in->type, &val, var_get_width (var),
dict_get_encoding (ia->formats.dict));
if (error != NULL)
{
dict_get_encoding (ia->formats.dict));
if (error != NULL)
{
@@
-1968,17
+1968,17
@@
make_data_column (struct import_assistant *ia, GtkTreeView *tree_view,
{
struct variable *var = NULL;
struct column *column = NULL;
{
struct variable *var = NULL;
struct column *column = NULL;
- char name[(VAR_NAME_LEN * 2) + 1];
size_t char_cnt;
gint content_width, header_width;
GtkTreeViewColumn *tree_column;
size_t char_cnt;
gint content_width, header_width;
GtkTreeViewColumn *tree_column;
+ char *name;
if (input)
column = &ia->separators.columns[dict_idx];
else
var = dict_get_var (ia->formats.dict, dict_idx);
if (input)
column = &ia->separators.columns[dict_idx];
else
var = dict_get_var (ia->formats.dict, dict_idx);
-
escape_underscores (input ? column->name : var_get_name (var), name
);
+
name = escape_underscores (input ? column->name : var_get_name (var)
);
char_cnt = input ? column->width : var_get_print_format (var)->w;
content_width = get_monospace_width (tree_view, ia->asst.fixed_renderer,
char_cnt);
char_cnt = input ? column->width : var_get_print_format (var)->w;
content_width = get_monospace_width (tree_view, ia->asst.fixed_renderer,
char_cnt);
@@
-1998,6
+1998,8
@@
make_data_column (struct import_assistant *ia, GtkTreeView *tree_view,
gtk_tree_view_column_set_fixed_width (tree_column, MAX (content_width,
header_width));
gtk_tree_view_column_set_fixed_width (tree_column, MAX (content_width,
header_width));
+ free (name);
+
return tree_column;
}
return tree_column;
}
@@
-2028,16
+2030,22
@@
create_data_tree_view (bool input, GtkContainer *parent,
return tree_view;
}
return tree_view;
}
-static
void
-escape_underscores (const char *in
, char *out
)
+static
char *
+escape_underscores (const char *in)
{
{
+ char *out = xmalloc (2 * strlen (in) + 1);
+ char *p;
+
+ p = out;
for (; *in != '\0'; in++)
{
if (*in == '_')
for (; *in != '\0'; in++)
{
if (*in == '_')
- *
out
++ = '_';
- *
out
++ = *in;
+ *
p
++ = '_';
+ *
p
++ = *in;
}
}
- *out = '\0';
+ *p = '\0';
+
+ return out;
}
\f
/* TextImportModel, a GtkTreeModel implementation used by some
}
\f
/* TextImportModel, a GtkTreeModel implementation used by some