/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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
if (file->handle == NULL)
goto error;
- file->reader = any_reader_open (file->handle, NULL, &file->dict);
+ file->reader = any_reader_open_and_decode (file->handle, NULL,
+ &file->dict, NULL);
if (file->reader == NULL)
goto error;
}
while (lex_match (lexer, T_SLASH))
if (lex_match_id (lexer, "RENAME"))
{
- if (!parse_dict_rename (lexer, file->dict))
+ if (!parse_dict_rename (lexer, file->dict, false))
goto error;
}
else if (lex_match_id (lexer, "IN"))
saw_sort = true;
}
- merge_dictionary (proc.dict, file);
+ if (!merge_dictionary (proc.dict, file))
+ goto error;
}
while (lex_token (lexer) != T_ENDCMD)
if (active_file == NULL)
{
proc_discard_output (ds);
- file->reader = active_file = proc_open (ds);
+ file->reader = active_file = proc_open_filtering (ds, false);
}
else
file->reader = casereader_clone (active_file);
The correct thing to do would be to convert to an encoding
which can cope with all the input files (eg UTF-8).
*/
- if ( 0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m)))
+ if (0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m)))
msg (MW, _("Combining files with incompatible encodings. String data may "
"not be represented correctly."));
if (var_get_width (mv) != var_get_width (dv))
{
const char *var_name = var_get_name (dv);
- const char *file_name = fh_get_name (f->handle);
struct string s = DS_EMPTY_INITIALIZER;
+ const char *file_name;
+
+ file_name = f->handle ? fh_get_name (f->handle) : "*";
ds_put_format (&s,
_("Variable %s in file %s has different "
"type or width from the same variable in "
if (var_has_missing_values (dv) && !var_has_missing_values (mv))
var_set_missing_values (mv, var_get_missing_values (dv));
if (var_get_label (dv) && !var_get_label (mv))
- var_set_label (mv, var_get_label (dv), false);
+ var_set_label (mv, var_get_label (dv));
}
else
mv = dict_clone_var_assert (m, dv);
subcase_destroy (&file->dst);
free (file->mv);
fh_unref (file->handle);
- dict_destroy (file->dict);
+ dict_unref (file->dict);
casereader_destroy (file->reader);
case_unref (file->data);
free (file->in_name);
free_comb_proc (struct comb_proc *proc)
{
close_all_comb_files (proc);
- dict_destroy (proc->dict);
+ dict_unref (proc->dict);
casewriter_destroy (proc->output);
case_matcher_destroy (proc->matcher);
if (proc->prev_BY)
size_t i;
output = create_output_case (proc);
- for (i = proc->n_files; i-- > 0; )
+ for (i = proc->n_files; i-- > 0;)
{
struct comb_file *file = &proc->files[i];
if (file->type == COMB_FILE)
{
struct comb_file *file = &proc->files[i];
if (file->in_var != NULL)
- case_data_rw (output, file->in_var)->f = false;
+ *case_num_rw (output, file->in_var) = false;
}
return output;
}
mark_file_used (const struct comb_file *file, struct ccase *output)
{
if (file->in_var != NULL)
- case_data_rw (output, file->in_var)->f = true;
+ *case_num_rw (output, file->in_var) = true;
}
/* Copies the data from FILE's case into output case OUTPUT.
{
new_BY = !subcase_equal_xx (&proc->by_vars, proc->prev_BY, by);
if (proc->last != NULL)
- case_data_rw (proc->buffered_case, proc->last)->f = new_BY;
+ *case_num_rw (proc->buffered_case, proc->last) = new_BY;
casewriter_write (proc->output, proc->buffered_case);
}
else
proc->buffered_case = output;
if (proc->first != NULL)
- case_data_rw (proc->buffered_case, proc->first)->f = new_BY;
+ *case_num_rw (proc->buffered_case, proc->first) = new_BY;
if (new_BY)
{
if (proc->prev_BY != NULL)
{
if (proc->last != NULL)
- case_data_rw (proc->buffered_case, proc->last)->f = 1.0;
+ *case_num_rw (proc->buffered_case, proc->last) = 1.0;
casewriter_write (proc->output, proc->buffered_case);
proc->buffered_case = NULL;
}