/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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
/* Reads the dictionary from file with handle H, and returns it in a
dictionary structure. This dictionary may be modified in order to
rename, reorder, and delete variables, etc. */
-struct any_reader *
+static struct any_reader *
pfm_open (struct file_handle *fh)
{
struct pool *volatile pool = NULL;
return NULL;
}
-struct casereader *
+static struct casereader *
pfm_decode (struct any_reader *r_, const char *encoding UNUSED,
struct dictionary **dictp, struct any_read_info *info)
{
return c;
}
-/* Returns true if FILE is an SPSS portable file,
- false otherwise. */
-int
+/* Detects whether FILE is an SPSS portable file. Returns 1 if so, 0 if not,
+ and a negative errno value if there is an error reading FILE. */
+static int
pfm_detect (FILE *file)
{
unsigned char header[464];
{
int c = getc (file);
if (c == EOF || raw_cnt++ > 512)
- return 0;
+ return ferror (file) ? -errno : 0;
else if (c == '\n')
{
while (line_len < 80 && cooked_cnt < sizeof header)