X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fflip.c;h=77881868b0c3fcc0fd3b8fa29ead25b117882b95;hb=ec7e9edc4433264efc66e6e3d661c198148f87c9;hp=8f73c1debabfc0b1898f1429f6c344b345f378b5;hpb=9389f9870643a519cf69b84a9388a0a40315d903;p=pspp diff --git a/src/language/stats/flip.c b/src/language/stats/flip.c index 8f73c1deba..77881868b0 100644 --- a/src/language/stats/flip.c +++ b/src/language/stats/flip.c @@ -144,7 +144,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds) } } - flip->file = pool_tmpfile (flip->pool); + flip->file = pool_create_temp_file (flip->pool); if (flip->file == NULL) { msg (SE, _("Could not create temporary file for FLIP.")); @@ -186,7 +186,6 @@ cmd_flip (struct lexer *lexer, struct dataset *ds) { name = data_out_pool (value, dict_get_encoding (flip->dict), var_get_write_format (flip->new_names_var), flip->pool); - } var_names_add (flip->pool, &flip->new_names, name); } @@ -261,7 +260,6 @@ make_new_var (struct dictionary *dict, const char *name_) *cp = '_'; } *cp = '\0'; - str_uppercase (name); /* Use the mangled name, if it is available, or add numeric extensions until we find one that is. */ @@ -328,7 +326,7 @@ flip_file (struct flip_pgm *flip) return false; } - output_file = pool_tmpfile (flip->pool); + output_file = pool_create_temp_file (flip->pool); if (output_file == NULL) { msg (SE, _("Error creating FLIP source file.")); @@ -379,11 +377,7 @@ flip_file (struct flip_pgm *flip) case_idx += read_cases; } - if (pool_fclose (flip->pool, input_file) == EOF) - { - msg (SE, _("Error closing FLIP source file: %s."), strerror (errno)); - return false; - } + pool_fclose_temp_file (flip->pool, input_file); pool_unregister (flip->pool, input_buf); free (input_buf); @@ -403,6 +397,7 @@ static struct ccase * flip_casereader_read (struct casereader *reader, void *flip_) { struct flip_pgm *flip = flip_; + const char *encoding; struct ccase *c; size_t i; @@ -410,12 +405,10 @@ flip_casereader_read (struct casereader *reader, void *flip_) return false; c = case_create (casereader_get_proto (reader)); - data_in (ss_cstr (flip->old_names.names[flip->cases_read]), dict_get_encoding (flip->dict), - FMT_A, 0, - 0, 0, - flip->dict, - case_data_rw_idx (c, 0), 8); - + encoding = dict_get_encoding (flip->dict); + data_in (ss_cstr (flip->old_names.names[flip->cases_read]), encoding, + FMT_A, case_data_rw_idx (c, 0), 8, encoding); + for (i = 0; i < flip->n_cases; i++) { double in;