Fix level 3/4 compiler warnings

Fix level 3 and 4 compiler warnings in 'lzss.cpp'.
This commit is contained in:
Kawe Mazidjatari 2023-04-06 21:01:42 +02:00
parent 874faea430
commit 5e95b280c0

View File

@ -1,7 +1,7 @@
//========= Copyright © 1996-2007, Valve Corporation, All rights reserved. ============//
//
// LZSS Codec. Designed for fast cheap gametime encoding/decoding. Compression results
// are not aggresive as other alogrithms, but gets 2:1 on most arbitrary uncompressed data.
// LZSS Codec. Designed for fast cheap game-time encoding/decoding. Compression results are
// not as aggressive as other algorithms, but gets 2:1 on most arbitrary uncompressed data.
//
//=====================================================================================//
@ -158,8 +158,8 @@ unsigned char *CLZSS::CompressNoAlloc( unsigned char *pInput, int inputLength, u
if ( encodedLength >= 3 )
{
*pCmdByte = ( *pCmdByte >> 1 ) | 0x80;
*pOutput++ = ( ( pLookAhead-pEncodedPosition-1 ) >> LZSS_LOOKSHIFT );
*pOutput++ = ( ( pLookAhead-pEncodedPosition-1 ) << LZSS_LOOKSHIFT ) | ( encodedLength-1 );
*pOutput++ = char( ( ( pLookAhead-pEncodedPosition-1 ) >> LZSS_LOOKSHIFT ) );
*pOutput++ = char( ( ( pLookAhead-pEncodedPosition-1 ) << LZSS_LOOKSHIFT ) | ( encodedLength-1 ) );
}
else
{
@ -204,7 +204,7 @@ unsigned char *CLZSS::CompressNoAlloc( unsigned char *pInput, int inputLength, u
if ( pOutputSize )
{
*pOutputSize = pOutput - pStart;
*pOutputSize = (unsigned int)( pOutput - pStart );
}
return pStart;
@ -330,7 +330,7 @@ unsigned int CLZSS::SafeUncompress( unsigned char *pInput, unsigned char *pOutpu
break;
}
if ( position + 1 > totalBytes || // out of bounds
if ( (unsigned int)( position + 1 ) > totalBytes || // out of bounds
totalBytes + count > unBufSize )
{
return 0;