From: John Darrington Date: Sat, 2 Oct 2010 13:59:11 +0000 (+0200) Subject: Use macros from cast.h instead of literal casts X-Git-Tag: v0.7.6~128 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97f9b8ad137e333af9b3c767556d28dfda93a461;p=pspp-builds.git Use macros from cast.h instead of literal casts --- diff --git a/src/data/case-tmpfile.c b/src/data/case-tmpfile.c index b2444b9b..58e437ad 100644 --- a/src/data/case-tmpfile.c +++ b/src/data/case-tmpfile.c @@ -52,7 +52,7 @@ width_to_n_bytes (int width) static void * value_to_data (const union value *value_, int width) { - union value *value = (union value *) value_; + union value *value = CONST_CAST (union value *, value_); assert (sizeof value->f == sizeof (double)); if (width == 0) return &value->f; diff --git a/src/data/case.h b/src/data/case.h index 0bfc62cd..d00c2ad3 100644 --- a/src/data/case.h +++ b/src/data/case.h @@ -135,7 +135,7 @@ case_unshare (struct ccase *c) static inline struct ccase * case_ref (const struct ccase *c_) { - struct ccase *c = (struct ccase *) c_; + struct ccase *c = CONST_CAST (struct ccase *, c_); c->ref_cnt++; return c; } diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 9222f7ec..5f86bbf5 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -330,7 +330,7 @@ void dict_get_vars (const struct dictionary *d, const struct variable ***vars, size_t *cnt, enum dict_class exclude) { - dict_get_vars_mutable (d, (struct variable ***) vars, cnt, exclude); + dict_get_vars_mutable (d, CONST_CAST (struct variable ***, vars), cnt, exclude); } /* Sets *VARS to an array of pointers to variables in D and *CNT diff --git a/src/data/gnumeric-reader.c b/src/data/gnumeric-reader.c index 1e18cc7b..26b90ee8 100644 --- a/src/data/gnumeric-reader.c +++ b/src/data/gnumeric-reader.c @@ -181,9 +181,9 @@ struct gnumeric_reader static void process_node (struct gnumeric_reader *r); -#define _xml(X) (const xmlChar *)(X) +#define _xml(X) (CHAR_CAST (const xmlChar *, X)) -#define _xmlchar_to_int(X) atoi((const char *)X) +#define _xmlchar_to_int(X) (atoi(CHAR_CAST (const char *, X))) static void gnm_file_casereader_destroy (struct casereader *reader UNUSED, void *r_) @@ -328,7 +328,7 @@ convert_xml_string_to_value (struct ccase *c, const struct variable *var, value_copy_str_rpad (v, var_get_width (var), xv, ' '); else { - const char *text = (const char *) xv; + const char *text = CHAR_CAST (const char *, xv); char *endptr; errno = 0; @@ -459,7 +459,7 @@ gnumeric_open_reader (struct gnumeric_read_info *gri, struct dictionary **dict) if ( r->node_type == XML_READER_TYPE_TEXT ) { xmlChar *value = xmlTextReaderValue (r->xtr); - const char *text = (const char *) value; + const char *text = CHAR_CAST (const char *, value); if ( r->row < r->start_row) { @@ -499,7 +499,7 @@ gnumeric_open_reader (struct gnumeric_read_info *gri, struct dictionary **dict) /* Create the dictionary and populate it */ *dict = r->dict = dict_create (); - dict_set_encoding (r->dict, (const char *) xmlTextReaderConstEncoding (r->xtr)); + dict_set_encoding (r->dict, CHAR_CAST (const char *, xmlTextReaderConstEncoding (r->xtr))); for (i = 0 ; i < n_var_specs ; ++i ) { diff --git a/src/output/odt.c b/src/output/odt.c index 90632396..721e7c87 100644 --- a/src/output/odt.c +++ b/src/output/odt.c @@ -49,7 +49,7 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -#define _xml(X) (const xmlChar *)(X) +#define _xml(X) (CHAR_CAST (const xmlChar *, X)) struct odt_driver { diff --git a/src/output/render.c b/src/output/render.c index 8c02833c..094e6879 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1212,7 +1212,7 @@ render_page_select (const struct render_page *page, enum table_axis axis, if (z0 == page->h[a][0] && p0 == 0 && z1 == page->n[a] - page->h[a][1] && p1 == 0) { - struct render_page *page_rw = (struct render_page *) page; + struct render_page *page_rw = CONST_CAST (struct render_page *, page); page_rw->ref_cnt++; return page_rw; }