|
7 | 7 | * of patent rights can be found in the RakNet Patents.txt file in the same directory. |
8 | 8 | * |
9 | 9 | * |
10 | | - * Modified work: Copyright (c) 2016-2018, SLikeSoft UG (haftungsbeschränkt) |
| 10 | + * Modified work: Copyright (c) 2016-2019, SLikeSoft UG (haftungsbeschränkt) |
11 | 11 | * |
12 | 12 | * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style |
13 | 13 | * license found in the license.txt file in the root directory of this source tree. |
@@ -272,10 +272,8 @@ bool BitStream::Read( char* outByteArray, const unsigned int numberOfBytes ) |
272 | 272 | readOffset += numberOfBytes << 3; |
273 | 273 | return true; |
274 | 274 | } |
275 | | - else |
276 | | - { |
277 | | - return ReadBits( ( unsigned char* ) outByteArray, numberOfBytes * 8 ); |
278 | | - } |
| 275 | + |
| 276 | + return ReadBits( ( unsigned char* ) outByteArray, numberOfBytes * 8 ); |
279 | 277 | } |
280 | 278 |
|
281 | 279 | // Sets the read pointer back to the beginning of your data. |
@@ -534,6 +532,11 @@ void BitStream::WriteCompressed( const unsigned char* inByteArray, |
534 | 532 | } |
535 | 533 | } |
536 | 534 |
|
| 535 | +void BitStream::AlignReadToByteBoundary() |
| 536 | +{ |
| 537 | + readOffset += 8 - ( (( readOffset - 1 ) & 7 ) + 1 ); |
| 538 | +} |
| 539 | + |
537 | 540 | // Read numberOfBitsToRead bits to the output source |
538 | 541 | // alignBitsToRight should be set to true to convert internal bitstream data to userdata |
539 | 542 | // It should be false if you used WriteBits with rightAlignedBits false |
@@ -939,6 +942,11 @@ void BitStream::PrintHex( void ) const |
939 | 942 | RAKNET_DEBUG_PRINTF("%s", out); |
940 | 943 | } |
941 | 944 |
|
| 945 | +void BitStream::SetReadOffset(const BitSize_t newReadOffset) |
| 946 | +{ |
| 947 | + readOffset = newReadOffset; |
| 948 | +} |
| 949 | + |
942 | 950 | // Exposes the data for you to look at, like PrintBits does. |
943 | 951 | // Data will point to the stream. Returns the length in bits of the stream. |
944 | 952 | BitSize_t BitStream::CopyData( unsigned char** _data ) const |
|
0 commit comments