#include "libpspp/array.h"
#include "libpspp/assertion.h"
#include "libpspp/compiler.h"
#include "libpspp/array.h"
#include "libpspp/assertion.h"
#include "libpspp/compiler.h"
/* File state. */
struct file_handle *fh; /* File handle. */
struct fh_lock *lock; /* Mutual exclusion for file handle. */
/* File state. */
struct file_handle *fh; /* File handle. */
struct fh_lock *lock; /* Mutual exclusion for file handle. */
off_t pos; /* Position in file. */
bool error; /* I/O or corruption error? */
struct caseproto *proto; /* Format of output cases. */
off_t pos; /* Position in file. */
bool error; /* I/O or corruption error? */
struct caseproto *proto; /* Format of output cases. */
{
msg (ME, _("Error opening `%s' for reading as a system file: %s."),
fh_get_file_name (r->fh), strerror (errno));
goto error;
}
{
msg (ME, _("Error opening `%s' for reading as a system file: %s."),
fh_get_file_name (r->fh), strerror (errno));
goto error;
}
read_bytes_internal (struct sfm_reader *r, bool eof_is_ok,
void *buf, size_t byte_cnt)
{
read_bytes_internal (struct sfm_reader *r, bool eof_is_ok,
void *buf, size_t byte_cnt)
{
- size_t bytes_read = fread (buf, 1, byte_cnt, r->file);
+ size_t bytes_read = fbuf_read (r->fbuf, buf, byte_cnt);
{
sys_error (r, r->pos, _("System error: %s."), strerror (errno));
return -1;
{
sys_error (r, r->pos, _("System error: %s."), strerror (errno));
return -1;
sys_error (r, 0, _("%s: seek failed (%s)."),
sys_error (r, 0, _("%s: seek failed (%s)."),
{
sys_error (r, 0, _("%s: stat failed (%s)."),
{
sys_error (r, 0, _("%s: stat failed (%s)."),
{
/* We can't seek to the trailer and then back to the data in this file,
so skip doing extra checks. */
return true;
}
{
/* We can't seek to the trailer and then back to the data in this file,
so skip doing extra checks. */
return true;
}