diff options
author | Fernando Carvajal <fcarvajal@qindel.com> | 2016-04-12 11:52:22 +0200 |
---|---|---|
committer | Fernando Carvajal <fcarvajal@qindel.com> | 2016-04-12 12:07:53 +0200 |
commit | a9be6f59105b7cf29bb799556274dc2c3b3d2af8 (patch) | |
tree | 555bfeba04b21dc26df16ee5c26a3ec798d02584 /nxcomp/DecodeBuffer.cpp | |
parent | 2ffe52c5ecb7cf6af111c685eee7f8fcfd1139a9 (diff) | |
download | nx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.tar.gz nx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.tar.bz2 nx-libs-a9be6f59105b7cf29bb799556274dc2c3b3d2af8.zip |
Remove compatibility code for nxcomp before 3.5.0
As a part of nxcomp's clean-up process, compatibility with old protocol
versions has been set now at 3.5.0.
This commit removes compatibility code from nxcomp so the minimum supported
version changes from 1.5.0 (protocol step 6) to 3.5.0 (protocol step 10).
At this moment the removal is not complete and it will be followed by some
other commits, in order to get rid of several components and files that are
no longer used as they were only needed to work with old protocol versions.
Refs: ArcticaProject/nx-libs#108
Diffstat (limited to 'nxcomp/DecodeBuffer.cpp')
-rw-r--r-- | nxcomp/DecodeBuffer.cpp | 95 |
1 files changed, 15 insertions, 80 deletions
diff --git a/nxcomp/DecodeBuffer.cpp b/nxcomp/DecodeBuffer.cpp index 077bfdfc0..28c656cb2 100644 --- a/nxcomp/DecodeBuffer.cpp +++ b/nxcomp/DecodeBuffer.cpp @@ -34,10 +34,8 @@ DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length) : buffer_(data), end_(buffer_ + length), nextSrc_(buffer_), srcMask_(0x80) { - if (control -> isProtoStep7() == 1) - { - end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE; - } + // Since ProtoStep7 (#issue 108) + end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE; } int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits, @@ -277,63 +275,25 @@ int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, if (index == 2) { - if (control -> isProtoStep8() == 1) - { - blockSize = cache.getBlockSize(blockSize); - - if (decodeValue(value, numBits, blockSize, endOkay)) - { - cache.insert(value, IntMask[numBits]); - - return 1; - } + // Since ProtoStep8 (#issue 108) + blockSize = cache.getBlockSize(blockSize); - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " - << "in decodeCacheValue() with no value found.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [H].\n"; - - HandleAbort(); - } - else + if (decodeValue(value, numBits, blockSize, endOkay)) { - unsigned int sameDiff; - - decodeBoolValue(sameDiff); - - if (sameDiff) - { - value = cache.getLastDiff(IntMask[numBits]); + cache.insert(value, IntMask[numBits]); - cache.insert(value, IntMask[numBits]); - - return 1; - } - else - { - blockSize = cache.getBlockSize(blockSize); - - if (decodeValue(value, numBits, blockSize, endOkay)) - { - cache.insert(value, IntMask[numBits]); - - return 1; - } + return 1; + } - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " - << "in decodeCacheValue() with no value found.\n" - << logofs_flush; - #endif + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " + << "in decodeCacheValue() with no value found.\n" + << logofs_flush; + #endif - cerr << "Error" << ": Failure decoding data in context [H].\n"; + cerr << "Error" << ": Failure decoding data in context [H].\n"; - HandleAbort(); - } - } + HandleAbort(); } else { @@ -665,28 +625,3 @@ void DecodeBuffer::decodeFreeXidValue(unsigned int &value, FreeCache &cache) decodeCachedValue(value, 29, cache); } -void DecodeBuffer::decodePositionValueCompat(short int &value, PositionCacheCompat &cache) -{ - unsigned int t; - - decodeCachedValue(t, 13, *(cache.base_[cache.slot_])); - - cache.last_ += t; - cache.last_ &= 0x1fff; - - value = cache.last_; - - #ifdef DEBUG - *logofs << "DecodeBuffer: Decoded position " - << value << " with base " << cache.slot_ - << ".\n" << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "DecodeBuffer: Position block prediction is " - << (*(cache.base_[cache.slot_])).getBlockSize(13) - << ".\n" << logofs_flush; - #endif - - cache.slot_ = (value & 0x1f); -} |