From be1d346c28c1ca0e7db109368285f90303cd00d9 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 15 Nov 2017 12:12:06 +0200 Subject: [PATCH] Open3DGC: Add assertions to silence static analyzer warnings --- contrib/Open3DGC/o3dgcArithmeticCodec.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/Open3DGC/o3dgcArithmeticCodec.cpp b/contrib/Open3DGC/o3dgcArithmeticCodec.cpp index 1d160ba95..3597ec39a 100644 --- a/contrib/Open3DGC/o3dgcArithmeticCodec.cpp +++ b/contrib/Open3DGC/o3dgcArithmeticCodec.cpp @@ -820,6 +820,7 @@ namespace o3dgc for (unsigned n = 0; n < data_symbols; n++) total_count += (symbol_count[n] = (symbol_count[n] + 1) >> 1); } + assert(total_count > 0); // compute cumulative distribution, decoder table unsigned k, sum = 0, s = 0; unsigned scale = 0x80000000U / total_count; @@ -830,6 +831,7 @@ namespace o3dgc sum += symbol_count[k]; } else { + assert(decoder_table); for (k = 0; k < data_symbols; k++) { distribution[k] = (scale * sum) >> (31 - DM__LengthShift); sum += symbol_count[k];