spv-light-decoder: Support special format 40 in decode_spvlb_value().
[pspp] / src / output / spv / spv-light-decoder.c
index 20f7afa11b338819c902e3565bdddcde00463b8f..0ce5c06924c3c52e78952e752dba1eecab431640 100644 (file)
@@ -302,6 +302,7 @@ decode_spvlb_value (const struct pivot_table *table,
       out->type = PIVOT_VALUE_NUMERIC;
       out->numeric.x = in->type_01.x;
       error = spv_decode_fmt_spec (in->type_01.format, &out->numeric.format);
+      out->numeric.honor_small = (in->type_01.format >> 16) == 40;
       if (error)
         return error;
       break;
@@ -415,6 +416,7 @@ decode_spvlb_value (const struct pivot_table *table,
 
               out->footnote_indexes[out->n_footnotes++] = idx;
             }
+          pivot_value_sort_footnotes (out);
         }
 
       if (vm->style_pair)
@@ -728,7 +730,7 @@ decode_data_index (uint64_t in, const struct pivot_table *table,
                    size_t *out)
 {
   uint64_t remainder = in;
-  for (size_t i = table->n_dimensions - 1; i > 0; i--)
+  for (size_t i = table->n_dimensions - 1; i < table->n_dimensions; i--)
     {
       const struct pivot_dimension *d = table->dimensions[i];
       if (d->n_leaves)
@@ -739,10 +741,9 @@ decode_data_index (uint64_t in, const struct pivot_table *table,
       else
         out[i] = 0;
     }
-  if (remainder >= table->dimensions[0]->n_leaves)
+  if (remainder)
     return xasprintf ("out of range cell data index %"PRIu64, in);
 
-  out[0] = remainder;
   return NULL;
 }