From 5e95b280c088f6354547301bf7a50347392f0c1f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 6 Apr 2023 21:01:42 +0200 Subject: [PATCH] Fix level 3/4 compiler warnings Fix level 3 and 4 compiler warnings in 'lzss.cpp'. --- r5dev/tier1/lzss.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/r5dev/tier1/lzss.cpp b/r5dev/tier1/lzss.cpp index 761dd94f..f4492ec2 100644 --- a/r5dev/tier1/lzss.cpp +++ b/r5dev/tier1/lzss.cpp @@ -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;