File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11#pragma once
22#include " ../utility/assert.h"
3- #include " ../utility/bits.h"
43
54#include " ../stream/serialize_traits.h"
65#include " ../stream/bit_reader.h"
@@ -26,12 +25,14 @@ namespace bitstream
2625 bool use_bits;
2726 if (Stream::writing)
2827 use_bits = difference <= Max;
29- BS_ASSERT (stream.serialize <bool >(use_bits));
28+ if (!stream.serialize <bool >(use_bits))
29+ return false ;
3030 if (use_bits)
3131 {
3232 using bounded_trait = bounded_int<uint32_t , Min, Max>;
3333
34- BS_ASSERT (stream.serialize <bounded_trait>(difference));
34+ if (!stream.serialize <bounded_trait>(difference))
35+ return false ;
3536 if (Stream::reading)
3637 current = previous + difference;
3738 previous = current;
@@ -56,7 +57,8 @@ namespace bitstream
5657 bool plus_one;
5758 if (Stream::writing)
5859 plus_one = difference == 1 ;
59- BS_ASSERT (stream.serialize <bool >(plus_one));
60+ if (!stream.serialize <bool >(plus_one))
61+ return false ;
6062 if (plus_one)
6163 {
6264 if (Stream::reading)
@@ -86,7 +88,8 @@ namespace bitstream
8688 return true ;
8789
8890 // [126,MaxObjects+1]
89- BS_ASSERT (stream.serialize <uint32_t >(difference, 126 , max_size));
91+ if (!stream.serialize <uint32_t >(difference, 126 , max_size))
92+ return false ;
9093 if (Stream::reading)
9194 current = previous + difference;
9295 previous = current;
You can’t perform that action at this time.
0 commit comments