Browse Source

Open3DGC: Add assertions to silence static analyzer warnings

Turo Lamminen 7 years ago
parent
commit
be1d346c28
1 changed files with 2 additions and 0 deletions
  1. 2 0
      contrib/Open3DGC/o3dgcArithmeticCodec.cpp

+ 2 - 0
contrib/Open3DGC/o3dgcArithmeticCodec.cpp

@@ -820,6 +820,7 @@ namespace o3dgc
         for (unsigned n = 0; n < data_symbols; n++)
         for (unsigned n = 0; n < data_symbols; n++)
           total_count += (symbol_count[n] = (symbol_count[n] + 1) >> 1);
           total_count += (symbol_count[n] = (symbol_count[n] + 1) >> 1);
       }
       }
+      assert(total_count > 0);
                                  // compute cumulative distribution, decoder table
                                  // compute cumulative distribution, decoder table
       unsigned k, sum = 0, s = 0;
       unsigned k, sum = 0, s = 0;
       unsigned scale = 0x80000000U / total_count;
       unsigned scale = 0x80000000U / total_count;
@@ -830,6 +831,7 @@ namespace o3dgc
           sum += symbol_count[k];
           sum += symbol_count[k];
         }
         }
       else {
       else {
+        assert(decoder_table);
         for (k = 0; k < data_symbols; k++) {
         for (k = 0; k < data_symbols; k++) {
           distribution[k] = (scale * sum) >> (31 - DM__LengthShift);
           distribution[k] = (scale * sum) >> (31 - DM__LengthShift);
           sum += symbol_count[k];
           sum += symbol_count[k];