projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed error running 'make distcheck'
[pspp]
/
src
/
language
/
data-io
/
matrix-data.c
diff --git
a/src/language/data-io/matrix-data.c
b/src/language/data-io/matrix-data.c
index cd962e1f25e182add5bd032819e0983b7b374c7d..50a34642be79cebb749cc07ff0cc7932618d3f50 100644
(file)
--- a/
src/language/data-io/matrix-data.c
+++ b/
src/language/data-io/matrix-data.c
@@
-106,16
+106,16
@@
set_varname_column (struct ccase *outcase, const struct variable *vname,
const char *str)
{
int len = var_get_width (vname);
const char *str)
{
int len = var_get_width (vname);
- uint8_t *s =
value_str_rw (case_data_rw (outcase, vname), len
);
+ uint8_t *s =
case_str_rw (outcase, vname
);
- strncpy (
(char *) s
, str, len);
+ strncpy (
CHAR_CAST (char *, s)
, str, len);
}
static void
blank_varname_column (struct ccase *outcase, const struct variable *vname)
{
int len = var_get_width (vname);
}
static void
blank_varname_column (struct ccase *outcase, const struct variable *vname)
{
int len = var_get_width (vname);
- uint8_t *s =
value_str_rw (case_data_rw (outcase, vname), len
);
+ uint8_t *s =
case_str_rw (outcase, vname
);
memset (s, ' ', len);
}
memset (s, ' ', len);
}
@@
-137,7
+137,7
@@
preprocess (struct casereader *casereader0, const struct dictionary *dict, void
/* Make an initial pass to populate our temporary matrix */
struct casereader *pass0 = casereader_clone (casereader0);
struct ccase *c;
/* Make an initial pass to populate our temporary matrix */
struct casereader *pass0 = casereader_clone (casereader0);
struct ccase *c;
- union value *prev_values =
xcalloc (mformat->n_split_vars, sizeof *prev_values
);
+ union value *prev_values =
XCALLOC (mformat->n_split_vars, union value
);
int row = (mformat->triangle == LOWER && mformat->diagonal == NO_DIAGONAL) ? 1 : 0;
bool first_case = true;
for (; (c = casereader_read (pass0)) != NULL; case_unref (c))
int row = (mformat->triangle == LOWER && mformat->diagonal == NO_DIAGONAL) ? 1 : 0;
bool first_case = true;
for (; (c = casereader_read (pass0)) != NULL; case_unref (c))
@@
-181,7
+181,7
@@
preprocess (struct casereader *casereader0, const struct dictionary *dict, void
if (mformat->triangle == UPPER && mformat->diagonal == NO_DIAGONAL)
c_offset++;
const union value *v = case_data (c, mformat->rowtype);
if (mformat->triangle == UPPER && mformat->diagonal == NO_DIAGONAL)
c_offset++;
const union value *v = case_data (c, mformat->rowtype);
- const char *val =
(const char *) value_str (v, ROWTYPE_WIDTH
);
+ const char *val =
CHAR_CAST (const char *, v->s
);
if (0 == strncasecmp (val, "corr ", ROWTYPE_WIDTH) ||
0 == strncasecmp (val, "cov ", ROWTYPE_WIDTH))
{
if (0 == strncasecmp (val, "corr ", ROWTYPE_WIDTH) ||
0 == strncasecmp (val, "cov ", ROWTYPE_WIDTH))
{
@@
-220,6
+220,9
@@
preprocess (struct casereader *casereader0, const struct dictionary *dict, void
casereader_destroy (pass0);
free (prev_values);
casereader_destroy (pass0);
free (prev_values);
+ if (!matrices)
+ goto error;
+
/* Now make a second pass to fill in the other triangle from our
temporary matrix */
const int idx = var_get_dict_index (mformat->varname);
/* Now make a second pass to fill in the other triangle from our
temporary matrix */
const int idx = var_get_dict_index (mformat->varname);
@@
-230,8
+233,7
@@
preprocess (struct casereader *casereader0, const struct dictionary *dict, void
int col;
struct ccase *outcase = case_create (proto);
union value *v = case_data_rw (outcase, mformat->rowtype);
int col;
struct ccase *outcase = case_create (proto);
union value *v = case_data_rw (outcase, mformat->rowtype);
- uint8_t *n = value_str_rw (v, ROWTYPE_WIDTH);
- memcpy (n, "N ", ROWTYPE_WIDTH);
+ memcpy (v->s, "N ", ROWTYPE_WIDTH);
blank_varname_column (outcase, mformat->varname);
for (col = 0; col < mformat->n_continuous_vars; ++col)
{
blank_varname_column (outcase, mformat->varname);
for (col = 0; col < mformat->n_continuous_vars; ++col)
{
@@
-280,7
+282,7
@@
preprocess (struct casereader *casereader0, const struct dictionary *dict, void
case_unref (prev_case);
const union value *v = case_data (c, mformat->rowtype);
case_unref (prev_case);
const union value *v = case_data (c, mformat->rowtype);
- const char *val =
(const char *) value_str (v, ROWTYPE_WIDTH
);
+ const char *val =
CHAR_CAST (const char *, v->s
);
if (mformat->n >= 0)
{
if (0 == strncasecmp (val, "n ", ROWTYPE_WIDTH) ||
if (mformat->n >= 0)
{
if (0 == strncasecmp (val, "n ", ROWTYPE_WIDTH) ||
@@
-376,8
+378,9
@@
error:
if (prev_case)
case_unref (prev_case);
if (prev_case)
case_unref (prev_case);
- for (i = 0 ; i < n_splits; ++i)
- free (matrices[i]);
+ if (matrices)
+ for (i = 0 ; i < n_splits; ++i)
+ free (matrices[i]);
free (matrices);
casereader_destroy (casereader0);
casewriter_destroy (writer);
free (matrices);
casereader_destroy (casereader0);
casewriter_destroy (writer);