projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed sparse-array linker problem
[pspp-builds.git]
/
src
/
data
/
scratch-reader.c
diff --git
a/src/data/scratch-reader.c
b/src/data/scratch-reader.c
index e329d1c8184b04e2420712b92ac7c6330b2420dd..4459126bf71cb2b1da46f6a8865f0aae82001b2d 100644
(file)
--- a/
src/data/scratch-reader.c
+++ b/
src/data/scratch-reader.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 2006 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 2006 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-18,13
+17,18
@@
02110-1301, USA. */
#include <config.h>
02110-1301, USA. */
#include <config.h>
+
#include "scratch-reader.h"
#include "scratch-reader.h"
+
#include <stdlib.h>
#include <stdlib.h>
+
#include "casefile.h"
#include "dictionary.h"
#include "casefile.h"
#include "dictionary.h"
-#include <libpspp/message.h>
#include "file-handle-def.h"
#include "scratch-handle.h"
#include "file-handle-def.h"
#include "scratch-handle.h"
+#include <data/case.h>
+#include <libpspp/message.h>
+
#include "xalloc.h"
#include "gettext.h"
#include "xalloc.h"
#include "gettext.h"
@@
-66,16
+70,26
@@
scratch_reader_open (struct file_handle *fh, struct dictionary **dict)
*dict = dict_clone (sh->dictionary);
reader = xmalloc (sizeof *reader);
reader->fh = fh;
*dict = dict_clone (sh->dictionary);
reader = xmalloc (sizeof *reader);
reader->fh = fh;
- reader->casereader = casefile_get_reader (sh->casefile);
+ reader->casereader = casefile_get_reader (sh->casefile
, NULL
);
return reader;
}
return reader;
}
-/* Reads a case from READER into C.
+/* Reads a case from READER
and copies it
into C.
Returns true if successful, false on error or at end of file. */
bool
scratch_reader_read_case (struct scratch_reader *reader, struct ccase *c)
{
Returns true if successful, false on error or at end of file. */
bool
scratch_reader_read_case (struct scratch_reader *reader, struct ccase *c)
{
- return casereader_read (reader->casereader, c);
+ struct ccase tmp;
+ if (casereader_read (reader->casereader, &tmp))
+ {
+ case_copy (c, 0, &tmp, 0,
+ casefile_get_value_cnt (
+ casereader_get_casefile (reader->casereader)));
+ case_destroy (&tmp);
+ return true;
+ }
+ else
+ return false;
}
/* Returns true if an I/O error occurred on READER, false otherwise. */
}
/* Returns true if an I/O error occurred on READER, false otherwise. */