X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsys-file-reader.c;h=a1193de767dc4618d4a8a1bdf1b0e6f6d5e33341;hb=26abd623201f0fc5fb55c2314f695c22e1435dce;hp=7cd658ba818493a3c6ac58f7c5f1a561f73747df;hpb=fe7682b3c3d36cf9ba3e867588e5b808af833262;p=pspp diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index 7cd658ba81..a1193de767 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -408,7 +408,7 @@ sfm_open (struct file_handle *fh) if (r->lock == NULL) goto error; - r->file = fn_open (fh_get_file_name (fh), "rb"); + r->file = fn_open (fh, "rb"); if (r->file == NULL) { msg (ME, _("Error opening `%s' for reading as a system file: %s."), @@ -507,21 +507,21 @@ read_record (struct sfm_reader *r, int type, || subtype >= sizeof r->extensions / sizeof *r->extensions) { sys_warn (r, r->pos, - _("Unrecognized record type 7, subtype %d. Please " - "send a copy of this file, and the syntax which " - "created it to %s."), - subtype, PACKAGE_BUGREPORT); + _("Unrecognized record type 7, subtype %d. For help, " + "please send this file to %s and mention that you were " + "using %s."), + subtype, PACKAGE_BUGREPORT, PACKAGE_STRING); return skip_extension_record (r, subtype); } else if (r->extensions[subtype] != NULL) { sys_warn (r, r->pos, _("Record type 7, subtype %d found here has the same " - "type as the record found near offset 0x%llx. " - "Please send a copy of this file, and the syntax " - "which created it to %s."), + "type as the record found near offset 0x%llx. For " + "help, please send this file to %s and mention that " + "you were using %s."), subtype, (long long int) r->extensions[subtype]->pos, - PACKAGE_BUGREPORT); + PACKAGE_BUGREPORT, PACKAGE_STRING); return skip_extension_record (r, subtype); } else @@ -537,7 +537,7 @@ read_record (struct sfm_reader *r, int type, /* Returns the character encoding obtained from R, or a null pointer if R doesn't have an indication of its character encoding. */ -const char * +static const char * sfm_get_encoding (const struct sfm_reader *r) { /* The EXT_ENCODING record is the best way to determine dictionary @@ -894,7 +894,7 @@ sfm_close (struct any_reader *r_) if (r->file) { - if (fn_close (fh_get_file_name (r->fh), r->file) == EOF) + if (fn_close (r->fh, r->file) == EOF) { msg (ME, _("Error closing system file `%s': %s."), fh_get_file_name (r->fh), strerror (errno)); @@ -921,9 +921,8 @@ sys_file_casereader_destroy (struct casereader *reader UNUSED, void *r_) sfm_close (&r->any_reader); } -/* Returns 1 if FILE is an SPSS system file, - 0 if it is not, - otherwise a negative errno value. */ +/* Detects whether FILE is an SPSS system file. Returns 1 if so, 0 if not, and + a negative errno value if there is an error reading FILE. */ static int sfm_detect (FILE *file) { @@ -932,7 +931,7 @@ sfm_detect (FILE *file) if (fseek (file, 0, SEEK_SET) != 0) return -errno; if (fread (magic, 4, 1, file) != 1) - return feof (file) ? 0 : -errno; + return ferror (file) ? -errno : 0; magic[4] = '\0'; return (!strcmp (ASCII_MAGIC, magic) @@ -1346,9 +1345,9 @@ read_extension_record (struct sfm_reader *r, int subtype, } sys_warn (r, record->pos, - _("Unrecognized record type 7, subtype %d. Please send a " - "copy of this file, and the syntax which created it to %s."), - subtype, PACKAGE_BUGREPORT); + _("Unrecognized record type 7, subtype %d. For help, please " + "send this file to %s and mention that you were using %s."), + subtype, PACKAGE_BUGREPORT, PACKAGE_STRING); skip: return skip_bytes (r, n_bytes);