X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fcombine-files.c;h=21736da8c645239dec3dadcde4cae59765d0f712;hb=refs%2Fbuilds%2F20120627000503%2Fpspp;hp=0f09e735d9eb345a901920636d6850cc8a7071b0;hpb=b401615e6db40bf74394839b96600afe3a868a95;p=pspp diff --git a/src/language/data-io/combine-files.c b/src/language/data-io/combine-files.c index 0f09e735d9..21736da8c6 100644 --- a/src/language/data-io/combine-files.c +++ b/src/language/data-io/combine-files.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 @@ -35,6 +35,7 @@ #include "language/lexer/variable-parser.h" #include "language/stats/sort-criteria.h" #include "libpspp/assertion.h" +#include "libpspp/i18n.h" #include "libpspp/message.h" #include "libpspp/string-array.h" #include "libpspp/taint.h" @@ -160,7 +161,7 @@ combine_files (enum comb_command_type command, proc.files = NULL; proc.n_files = 0; - proc.dict = dict_create (); + proc.dict = dict_create (get_default_encoding ()); proc.output = NULL; proc.matcher = NULL; subcase_init_empty (&proc.by_vars); @@ -222,11 +223,11 @@ combine_files (enum comb_command_type command, } else { - file->handle = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH); + file->handle = fh_parse (lexer, FH_REF_FILE, dataset_session (ds)); if (file->handle == NULL) goto error; - file->reader = any_reader_open (file->handle, &file->dict); + file->reader = any_reader_open (file->handle, NULL, &file->dict); if (file->reader == NULL) goto error; } @@ -375,7 +376,7 @@ combine_files (enum comb_command_type command, { if (command == COMB_UPDATE) { - msg (SE, _("The BY subcommand is required.")); + lex_sbc_missing ("BY"); goto error; } if (n_tables) @@ -496,7 +497,6 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) struct dictionary *d = f->dict; const struct string_array *d_docs, *m_docs; int i; - const char *file_encoding; if (dict_get_label (m) == NULL) dict_set_label (m, dict_get_label (d)); @@ -510,17 +510,9 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) The correct thing to do would be to convert to an encoding which can cope with all the input files (eg UTF-8). */ - file_encoding = dict_get_encoding (f->dict); - if ( file_encoding != NULL) - { - if ( dict_get_encoding (m) == NULL) - dict_set_encoding (m, file_encoding); - else if ( 0 != strcmp (file_encoding, dict_get_encoding (m))) - { - msg (MW, - _("Combining files with incompatible encodings. String data may not be represented correctly.")); - } - } + 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 (d_docs != NULL) { @@ -590,7 +582,7 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) 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), file_encoding, false); + var_set_label (mv, var_get_label (dv), false); } else mv = dict_clone_var_assert (m, dv);