From: John Darrington Date: Fri, 8 Jun 2007 01:30:27 +0000 (+0000) Subject: Fixed constness issues. X-Git-Tag: v0.6.0~434 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc78471910e82d59232ce9b137b7c4fc4992d174;p=pspp-builds.git Fixed constness issues. --- diff --git a/po/de.po b/po/de.po index 5ce521ac..322959d9 100644 --- a/po/de.po +++ b/po/de.po @@ -3262,6 +3262,10 @@ msgstr "" msgid "Dependent variable must be numeric." msgstr "" +#: src/language/stats/regression.q:1320 +msgid "No valid data found. This command was skipped." +msgstr "" + #: src/language/stats/sort-cases.c:63 msgid "Buffer limit must be at least 2." msgstr "" diff --git a/src/data/case-ordering.c b/src/data/case-ordering.c index 54f1c7f2..aeb87b76 100644 --- a/src/data/case-ordering.c +++ b/src/data/case-ordering.c @@ -32,7 +32,7 @@ /* One key used for sorting. */ struct sort_key { - struct variable *var; /* Variable. */ + const struct variable *var; /* Variable. */ enum sort_direction dir; /* Sort direction. */ }; @@ -118,7 +118,7 @@ case_ordering_compare_cases (const struct ccase *a, const struct ccase *b, bool case_ordering_add_var (struct case_ordering *co, - struct variable *var, enum sort_direction dir) + const struct variable *var, enum sort_direction dir) { struct sort_key *key; size_t i; @@ -140,7 +140,7 @@ case_ordering_get_var_cnt (const struct case_ordering *co) return co->key_cnt; } -struct variable * +const struct variable * case_ordering_get_var (const struct case_ordering *co, size_t idx) { assert (idx < co->key_cnt); @@ -156,7 +156,7 @@ case_ordering_get_direction (const struct case_ordering *co, size_t idx) void case_ordering_get_vars (const struct case_ordering *co, - struct variable ***vars, size_t *var_cnt) + const struct variable ***vars, size_t *var_cnt) { size_t i; diff --git a/src/data/case-ordering.h b/src/data/case-ordering.h index f1b6c30f..f537829d 100644 --- a/src/data/case-ordering.h +++ b/src/data/case-ordering.h @@ -40,12 +40,12 @@ int case_ordering_compare_cases (const struct ccase *, const struct ccase *, const struct case_ordering *); bool case_ordering_add_var (struct case_ordering *, - struct variable *, enum sort_direction); + const struct variable *, enum sort_direction); size_t case_ordering_get_var_cnt (const struct case_ordering *); -struct variable *case_ordering_get_var (const struct case_ordering *, size_t); +const struct variable *case_ordering_get_var (const struct case_ordering *, size_t); enum sort_direction case_ordering_get_direction (const struct case_ordering *, size_t); void case_ordering_get_vars (const struct case_ordering *, - struct variable ***, size_t *); + const struct variable ***, size_t *); #endif /* data/case-ordering.h */ diff --git a/src/data/casegrouper.c b/src/data/casegrouper.c index 07b0614e..eee08700 100644 --- a/src/data/casegrouper.c +++ b/src/data/casegrouper.c @@ -129,7 +129,7 @@ casegrouper_destroy (struct casegrouper *grouper) struct casegrouper_vars { - struct variable **vars; + const struct variable **vars; size_t var_cnt; }; @@ -151,7 +151,7 @@ casegrouper_vars_destroy (void *cv_) struct casegrouper * casegrouper_create_vars (struct casereader *reader, - struct variable *const *vars, + const struct variable *const *vars, size_t var_cnt) { if (var_cnt > 0) @@ -181,7 +181,7 @@ struct casegrouper * casegrouper_create_case_ordering (struct casereader *reader, const struct case_ordering *co) { - struct variable **vars; + const struct variable **vars; size_t var_cnt; struct casegrouper *grouper; diff --git a/src/data/casegrouper.h b/src/data/casegrouper.h index e0a0e487..3d9c6a89 100644 --- a/src/data/casegrouper.h +++ b/src/data/casegrouper.h @@ -36,7 +36,7 @@ casegrouper_create_func (struct casereader *, void (*destroy) (void *aux), void *aux); struct casegrouper *casegrouper_create_vars (struct casereader *, - struct variable *const *vars, + const struct variable *const *vars, size_t var_cnt); struct casegrouper *casegrouper_create_splits (struct casereader *, const struct dictionary *); diff --git a/src/data/casereader-filter.c b/src/data/casereader-filter.c index 88d798e3..d06bdc86 100644 --- a/src/data/casereader-filter.c +++ b/src/data/casereader-filter.c @@ -205,7 +205,7 @@ casereader_filter_missing_destroy (void *cfm_) struct casereader * casereader_create_filter_missing (struct casereader *reader, - struct variable **vars, size_t var_cnt, + const struct variable **vars, size_t var_cnt, enum mv_class class, struct casewriter *exclude) { diff --git a/src/data/casereader.h b/src/data/casereader.h index bd066a90..8e056632 100644 --- a/src/data/casereader.h +++ b/src/data/casereader.h @@ -97,7 +97,7 @@ casereader_create_filter_weight (struct casereader *, struct casewriter *exclude); struct casereader * casereader_create_filter_missing (struct casereader *, - struct variable **vars, size_t var_cnt, + const struct variable **vars, size_t var_cnt, enum mv_class, struct casewriter *exclude); diff --git a/src/language/data-io/get.c b/src/language/data-io/get.c index 950afeb4..47bcf50f 100644 --- a/src/language/data-io/get.c +++ b/src/language/data-io/get.c @@ -660,7 +660,7 @@ struct mtf_file enum mtf_type type; int sequence; - struct variable **by; /* List of BY variables for this file. */ + const struct variable **by; /* List of BY variables for this file. */ struct mtf_variable *vars; /* Variables to copy to output. */ size_t var_cnt; /* Number of other variables. */ @@ -701,7 +701,7 @@ struct mtf_proc struct ccase buffered_case; /* Case ready for output except that we don't know the value for the LAST variable yet. */ struct ccase prev_BY_case; /* Case with values of last set of BY vars. */ - struct variable **prev_BY; /* Last set of BY variables. */ + const struct variable **prev_BY; /* Last set of BY variables. */ }; static void mtf_free (struct mtf_proc *); diff --git a/src/language/stats/npar-summary.c b/src/language/stats/npar-summary.c index 74532231..efb47458 100644 --- a/src/language/stats/npar-summary.c +++ b/src/language/stats/npar-summary.c @@ -53,7 +53,7 @@ npar_summary_calc_descriptives (struct descriptives *desc, pass = casereader_clone (input); pass = casereader_create_filter_missing (pass, - (struct variable **) &v, 1, + &v, 1, filter, NULL); pass = casereader_create_filter_weight (pass, dict, NULL, NULL); while (casereader_read(pass, &c)) diff --git a/src/language/stats/npar.h b/src/language/stats/npar.h index 80446c3a..cdbc1f1c 100644 --- a/src/language/stats/npar.h +++ b/src/language/stats/npar.h @@ -25,7 +25,7 @@ #include #include -typedef struct variable *variable_pair[2]; +typedef const struct variable *variable_pair[2]; struct hsh_table; struct const_hsh_table; diff --git a/src/language/stats/npar.q b/src/language/stats/npar.q index 74e8364f..e22c8396 100644 --- a/src/language/stats/npar.q +++ b/src/language/stats/npar.q @@ -73,7 +73,7 @@ struct npar_specs struct npar_test **test; size_t n_tests; - const struct variable *const* vv; /* Compendium of all variables + const struct variable ** vv; /* Compendium of all variables (those mentioned on ANY subcommand */ int n_vars; /* Number of variables in vv */ @@ -153,7 +153,7 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) test->insert_variables (test, var_hash); } - npar_specs.vv = (const struct variable *const *) const_hsh_data (var_hash); + npar_specs.vv = (const struct variable **) const_hsh_data (var_hash); npar_specs.n_vars = const_hsh_count (var_hash); if ( cmd.sbc_statistics ) @@ -188,7 +188,7 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) input = proc_open (ds); if ( cmd.miss == NPAR_LISTWISE ) input = casereader_create_filter_missing (input, - (struct variable **) npar_specs.vv, + npar_specs.vv, npar_specs.n_vars, npar_specs.filter, NULL); diff --git a/src/language/stats/rank.q b/src/language/stats/rank.q index c42f896a..df2150d3 100644 --- a/src/language/stats/rank.q +++ b/src/language/stats/rank.q @@ -172,7 +172,7 @@ static void rank_sorted_file (struct casereader *, const struct rank_spec *rs, int n_rank_specs, int idx, - struct variable *rank_var); + const struct variable *rank_var); static const char * fraction_name(void) @@ -467,7 +467,7 @@ rank_sorted_file (struct casereader *input, const struct rank_spec *rs, int n_rank_specs, int dest_idx, - struct variable *rank_var) + const struct variable *rank_var) { struct casereader *pass1, *pass2, *pass2_1; struct casegrouper *tie_grouper; diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index 690b6809..1f2ac2a6 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -1014,7 +1014,7 @@ regression_custom_variables (struct lexer *lexer, struct dataset *ds, /* Identify the explanatory variables in v_variables. Returns the number of independent variables. */ static int -identify_indep_vars (struct variable **indep_vars, struct variable *depvar) +identify_indep_vars (const struct variable **indep_vars, const struct variable *depvar) { int n_indep_vars = 0; int i; @@ -1030,7 +1030,7 @@ identify_indep_vars (struct variable **indep_vars, struct variable *depvar) Returns number of valid cases. */ static int prepare_categories (struct casereader *input, - struct variable **vars, size_t n_vars, + const struct variable **vars, size_t n_vars, struct moments_var *mom) { int n_data; @@ -1156,7 +1156,7 @@ run_regression (struct casereader *input, struct cmd_regression *cmd, for (k = 0; k < cmd->n_dependent; k++) { - struct variable *dep_var; + const struct variable *dep_var; struct casereader *reader; casenumber row; struct ccase c; @@ -1204,7 +1204,7 @@ run_regression (struct casereader *input, struct cmd_regression *cmd, { for (i = 0; i < n_indep; ++i) { - struct variable *v = indep_vars[i]; + const struct variable *v = indep_vars[i]; const union value *val = case_data (&c, v); if (var_is_alpha (v)) design_matrix_set_categorical (X, row, v, val); diff --git a/src/language/stats/sort-criteria.c b/src/language/stats/sort-criteria.c index bd1983dd..c22f1b0f 100644 --- a/src/language/stats/sort-criteria.c +++ b/src/language/stats/sort-criteria.c @@ -42,7 +42,7 @@ parse_case_ordering (struct lexer *lexer, const struct dictionary *dict, bool *saw_direction) { struct case_ordering *ordering = case_ordering_create (dict); - struct variable **vars = NULL; + const struct variable **vars = NULL; size_t var_cnt = 0; if (saw_direction != NULL)