projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reractor
[pspp]
/
utilities
/
pspp-dump-sav.c
diff --git
a/utilities/pspp-dump-sav.c
b/utilities/pspp-dump-sav.c
index 70687ebc803bb23a6f610b79f69a76476b0050fa..36cb285380f564c93edbc19be87d4f6383ba43bb 100644
(file)
--- a/
utilities/pspp-dump-sav.c
+++ b/
utilities/pspp-dump-sav.c
@@
-236,6
+236,8
@@
main (int argc, char *argv[])
else if (r.compression == COMP_ZLIB)
read_zlib_compressed_data (&r);
else if (r.compression == COMP_ZLIB)
read_zlib_compressed_data (&r);
+ free (r.var_widths);
+
fclose (r.file);
}
fclose (r.file);
}
@@
-517,14
+519,14
@@
print_untyped_value (struct sfm_reader *r, char raw_value[8])
static void
read_value_label_record (struct sfm_reader *r)
{
static void
read_value_label_record (struct sfm_reader *r)
{
- int
label_cnt, var_cnt
;
+ int
n_labels, n_vars
;
int i;
printf ("%08llx: value labels record\n", (long long int) ftello (r->file));
/* Read number of labels. */
int i;
printf ("%08llx: value labels record\n", (long long int) ftello (r->file));
/* Read number of labels. */
-
label_cnt
= read_int (r);
- for (i = 0; i <
label_cnt
; i++)
+
n_labels
= read_int (r);
+ for (i = 0; i <
n_labels
; i++)
{
char raw_value[8];
unsigned char label_len;
{
char raw_value[8];
unsigned char label_len;
@@
-557,8
+559,8
@@
read_value_label_record (struct sfm_reader *r)
/* Read number of variables associated with value label from type 4
record. */
printf ("\t%08llx: apply to variables", (long long int) ftello (r->file));
/* Read number of variables associated with value label from type 4
record. */
printf ("\t%08llx: apply to variables", (long long int) ftello (r->file));
-
var_cnt
= read_int (r);
- for (i = 0; i <
var_cnt
; i++)
+
n_vars
= read_int (r);
+ for (i = 0; i <
n_vars
; i++)
printf (" #%d", read_int (r));
putchar ('\n');
}
printf (" #%d", read_int (r));
putchar ('\n');
}
@@
-1018,6
+1020,8
@@
read_character_encoding (struct sfm_reader *r, size_t size, size_t count)
read_string (r, encoding, count + 1);
printf ("%08llx: Character Encoding: %s\n", posn, encoding);
read_string (r, encoding, count + 1);
printf ("%08llx: Character Encoding: %s\n", posn, encoding);
+
+ free (encoding);
}
static void
}
static void
@@
-1227,7
+1231,7
@@
read_simple_compressed_data (struct sfm_reader *r, int max_cases)
{
printf ("%08llx: case %d's uncompressible data begins\n",
(long long int) ftello (r->file), case_num);
{
printf ("%08llx: case %d's uncompressible data begins\n",
(long long int) ftello (r->file), case_num);
- for (i = 0; i < r->n_var_widths;
)
+ for (i = 0; i < r->n_var_widths;)
{
int width = r->var_widths[i];
char raw_value[8];
{
int width = r->var_widths[i];
char raw_value[8];
@@
-1586,10
+1590,10
@@
sys_error (struct sfm_reader *r, const char *format, ...)
too. */
static inline bool
read_bytes_internal (struct sfm_reader *r, bool eof_is_ok,
too. */
static inline bool
read_bytes_internal (struct sfm_reader *r, bool eof_is_ok,
- void *buf, size_t
byte_cnt
)
+ void *buf, size_t
n_bytes
)
{
{
- size_t bytes_read = fread (buf, 1,
byte_cnt
, r->file);
- if (bytes_read ==
byte_cnt
)
+ size_t bytes_read = fread (buf, 1,
n_bytes
, r->file);
+ if (bytes_read ==
n_bytes
)
return true;
else if (ferror (r->file))
sys_error (r, "System error: %s.", strerror (errno));
return true;
else if (ferror (r->file))
sys_error (r, "System error: %s.", strerror (errno));
@@
-1602,9
+1606,9
@@
read_bytes_internal (struct sfm_reader *r, bool eof_is_ok,
/* Reads BYTE_CNT into BUF.
Aborts upon I/O error or if end-of-file is encountered. */
static void
/* Reads BYTE_CNT into BUF.
Aborts upon I/O error or if end-of-file is encountered. */
static void
-read_bytes (struct sfm_reader *r, void *buf, size_t
byte_cnt
)
+read_bytes (struct sfm_reader *r, void *buf, size_t
n_bytes
)
{
{
- read_bytes_internal (r, false, buf,
byte_cnt
);
+ read_bytes_internal (r, false, buf,
n_bytes
);
}
/* Reads BYTE_CNT bytes into BUF.
}
/* Reads BYTE_CNT bytes into BUF.
@@
-1612,9
+1616,9
@@
read_bytes (struct sfm_reader *r, void *buf, size_t byte_cnt)
Returns false if an immediate end-of-file is encountered.
Aborts if an I/O error or a partial read occurs. */
static bool
Returns false if an immediate end-of-file is encountered.
Aborts if an I/O error or a partial read occurs. */
static bool
-try_read_bytes (struct sfm_reader *r, void *buf, size_t
byte_cnt
)
+try_read_bytes (struct sfm_reader *r, void *buf, size_t
n_bytes
)
{
{
- return read_bytes_internal (r, true, buf,
byte_cnt
);
+ return read_bytes_internal (r, true, buf,
n_bytes
);
}
/* Reads a 32-bit signed integer from R and returns its value in
}
/* Reads a 32-bit signed integer from R and returns its value in