X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv%2Fspv.c;h=cbdf10fcdf0a694a64e4efeeae6dfeaf67b1f31c;hb=c8d4730341536ea6120a273100b0333327bf880a;hp=f186e638e70c9f8944a31a826081bc36f3f5e296;hpb=50f6ea7d66d03895020891215fb4f55bbf061003;p=pspp diff --git a/src/output/spv/spv.c b/src/output/spv/spv.c index f186e638e7..cbdf10fcdf 100644 --- a/src/output/spv/spv.c +++ b/src/output/spv/spv.c @@ -39,6 +39,7 @@ #include "output/spv/spv-legacy-data.h" #include "output/spv/spv-legacy-decoder.h" #include "output/spv/spv-light-decoder.h" +#include "output/spv/spv-table-look.h" #include "output/spv/structure-xml-parser.h" #include "gl/c-ctype.h" @@ -101,7 +102,7 @@ spv_item_class_from_string (const char *name) SPV_CLASSES #undef SPV_CLASS - return SPV_N_CLASSES; + return (enum spv_item_class) SPV_N_CLASSES; } enum spv_item_type @@ -259,7 +260,7 @@ spv_item_destroy (struct spv_item *item) free (item->children); pivot_table_unref (item->table); - spv_legacy_properties_destroy (item->legacy_properties); + pivot_table_look_unref (item->table_look); free (item->bin_member); free (item->xml_member); free (item->subtype); @@ -374,7 +375,7 @@ extract_html_text (const xmlNode *node, int base_font_size, struct string *s) else { uint8_t r, g, b; - if (sscanf (color, "rgb (%"SCNu8", %"SCNu8", %"SCNu8" )", + if (sscanf (color, "rgb (%"SCNu8", %"SCNu8", %"SCNu8")", &r, &g, &b) == 3) { char color2[8]; @@ -420,7 +421,7 @@ extract_html_text (const xmlNode *node, int base_font_size, struct string *s) Do the same for U+2007 FIGURE SPACE, which also crops out weirdly sometimes. */ ds_extend (s, ds_length (s) + xmlStrlen (node->content)); - for (const uint8_t *p = node->content; *p; ) + for (const uint8_t *p = node->content; *p;) { int c; if (p[0] == 0xc2 && p[1] == 0xa0) @@ -605,7 +606,7 @@ spv_item_get_light_table (const struct spv_item *item, struct spvbin_input input; spvbin_input_init (&input, data, size); - struct spvlb_table *table; + struct spvlb_table *table = NULL; error = (!size ? xasprintf ("light table member is empty") : !spvlb_parse_table (&input, &table) @@ -827,7 +828,7 @@ pivot_table_open_legacy (struct spv_item *item) error = spvxml_context_finish (&ctx, &v->node_); if (!error) - error = decode_spvdx_table (v, item->subtype, item->legacy_properties, + error = decode_spvdx_table (v, item->subtype, item->table_look, &data, &item->table); if (error) @@ -905,8 +906,10 @@ spv_decode_container (const struct spvsx_container *c, if (ts->path) { item->xml_member = ts->path ? xstrdup (ts->path->text) : NULL; - char *error = decode_spvsx_legacy_properties ( - table->table_properties, &item->legacy_properties); + char *error = (table->table_properties + ? spv_table_look_decode (table->table_properties, + &item->table_look) + : xstrdup ("Legacy table lacks tableProperties")); if (error) { spv_item_destroy (item); @@ -965,7 +968,7 @@ spv_decode_children (struct spv_reader *spv, const char *structure_member, { const struct spvxml_node *node = seq[i]; - char *error; + char *error = NULL; if (spvsx_is_container (node)) { const struct spvsx_container *container @@ -1184,6 +1187,21 @@ spv_close (struct spv_reader *spv) } } +void +spv_item_set_table_look (struct spv_item *item, + const struct pivot_table_look *look) +{ + /* If this is a table, install the table look in it. + + (We can't just set item->table_look because light tables ignore it and + legacy tables sometimes override it.) */ + if (spv_item_is_table (item)) + pivot_table_set_look (spv_item_get_table (item), look); + + for (size_t i = 0; i < item->n_children; i++) + spv_item_set_table_look (item->children[i], look); +} + char * WARN_UNUSED_RESULT spv_decode_fmt_spec (uint32_t u32, struct fmt_spec *out) {