File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class LZVerifier : public LZReceiver, public CompressedDataReadListener {
4747 return false ;
4848 }
4949 pos += 1 ;
50+ updateMargin ();
5051 return true ;
5152 }
5253
@@ -69,6 +70,7 @@ class LZVerifier : public LZReceiver, public CompressedDataReadListener {
6970 }
7071 }
7172 pos += length;
73+ updateMargin ();
7274 return true ;
7375 }
7476
@@ -79,11 +81,17 @@ class LZVerifier : public LZReceiver, public CompressedDataReadListener {
7981 void read (int index) {
8082 // Another byte of compresed data read
8183 if ((index & (read_size - 1 )) == 0 ) {
82- int margin = pos - compressed_read_count * read_size;
83- if (margin > front_overlap_margin) {
84- front_overlap_margin = margin;
85- }
86- compressed_read_count += 1 ;
84+ compressed_read_count += read_size;
85+ if (compressed_read_count > data_length)
86+ compressed_read_count = data_length;
87+ updateMargin ();
88+ }
89+ }
90+
91+ void updateMargin (void ) {
92+ int margin = pos - compressed_read_count;
93+ if (margin > front_overlap_margin) {
94+ front_overlap_margin = margin;
8795 }
8896 }
8997};
You can’t perform that action at this time.
0 commit comments