SpreadLevel Plot: Don't try to take the logarithm of a negative
[pspp] / src / output / pivot-output.c
index e068a50fc14dfb87999f6ad098f883202582606c..158116117f02b0a10ee098d77e8c3d776798fdf8 100644 (file)
@@ -219,7 +219,7 @@ compose_headings (struct table *t,
 
       for (int row_ofs = 0; row_ofs < d->label_depth; row_ofs++)
         {
-          for (size_t x1 = 0; x1 < n_columns; )
+          for (size_t x1 = 0; x1 < n_columns;)
             {
               const struct pivot_category *c = find_category (
                 d, dim_index, column_enumeration + x1 * stride, row_ofs);
@@ -339,7 +339,7 @@ pivot_table_submit_layer (const struct pivot_table *pt,
       out->b = in->color.b;
     }
 
-  struct footnote **footnotes = xcalloc (pt->n_footnotes, sizeof *footnotes);
+  struct footnote **footnotes = XCALLOC (pt->n_footnotes,  struct footnote *);
   for (size_t i = 0; i < pt->n_footnotes; i++)
     {
       const struct pivot_footnote *pf = pt->footnotes[i];
@@ -388,7 +388,7 @@ pivot_table_submit_layer (const struct pivot_table *pt,
                     pt->show_values, pt->show_variables,
                     false, pt->rotate_outer_row_labels);
 
-  size_t *dindexes = xcalloc (pt->n_dimensions, sizeof *dindexes);
+  size_t *dindexes = XCALLOC (pt->n_dimensions, size_t);
   size_t y = 0;
   PIVOT_ENUMERATION_FOR_EACH (pindexes[PIVOT_AXIS_ROW], row_enumeration,
                               &pt->axes[PIVOT_AXIS_ROW])
@@ -509,6 +509,8 @@ pivot_table_submit_layer (const struct pivot_table *pt,
     }
 
   free (footnotes);
+  ti->pt = pivot_table_ref (pt);
+
   table_item_submit (ti);
 }