Fix windows compilation.

This commit is contained in:
jmsgrogan 2022-11-30 20:53:17 +00:00
parent b45385e8c7
commit b17ba8b3a7
23 changed files with 85 additions and 53 deletions

View file

@ -48,7 +48,7 @@ void Lz77Encoder::populateSearchBuffer(const Hit& hit)
int difference = int(length) - distance;
if (difference > 0)
{
for(unsigned idx=0; idx<difference; idx++)
for(unsigned idx=0; idx<unsigned(difference); idx++)
{
mSearchBuffer.addItem(mLookaheadBuffer.getItem(idx));
}
@ -64,7 +64,7 @@ unsigned char Lz77Encoder::getSearchBufferItem(unsigned index) const
unsigned Lz77Encoder::lookAheadForMatchingChars(unsigned distance)
{
unsigned length{0};
for(unsigned idx=0; idx<mMaxLookAheadBufferIndex + 1; idx++)
for(unsigned idx=0; idx<unsigned(mMaxLookAheadBufferIndex + 1); idx++)
{
int search_offset = int(distance-1) - idx;
unsigned char search_char{0};
@ -112,7 +112,7 @@ bool Lz77Encoder::lookAheadSourceEmpty() const
return true;
}
if (mMaxLookAheadBufferIndex < mLookAheadBufferSize - 1)
if (mMaxLookAheadBufferIndex < int(mLookAheadBufferSize) - 1)
{
return true;
}

View file

@ -57,7 +57,7 @@ void ZlibEncoder::parseCompressionMethod(unsigned char method)
if (mCompressionMethod == CompressionMethod::DEFLATE)
{
mWindowSize = pow(2, compression_info + 8);
mWindowSize = static_cast<unsigned>(pow(2, compression_info + 8));
}
}

View file

@ -25,7 +25,6 @@ bool DeflateEncoder::encode()
std::unique_ptr<DeflateBlock> working_block = std::make_unique<DeflateBlock>(&stream, mOutputStream);
working_block->setCompressionMethod(mCompressionMethod);
AbstractChecksumCalculator* checksum_calc;
if (mChecksumCalculators.size() > 0)
{
//std::cout << "Setting checksum calculator " << std::endl;

View file

@ -120,7 +120,7 @@ void HuffmanStream::readCodeLengths()
mInputStream->readNextNBits(2, num_reps);
//std::cout << "Got val 16 doing " << 3 + num_reps << std::endl;
for(unsigned idx=0; idx< 3 + num_reps; idx++)
for(unsigned char idx=0; idx< 3 + num_reps; idx++)
{
addValue(last_value, count, last_value, literal_lengths, mNumLiterals, distance_lengths);
}
@ -131,7 +131,7 @@ void HuffmanStream::readCodeLengths()
mInputStream->readNextNBits(3, num_reps);
//std::cout << "Got val 17 doing " << 3 + num_reps << std::endl;
for(unsigned idx=0; idx< 3 + num_reps; idx++)
for(unsigned char idx=0; idx< 3 + num_reps; idx++)
{
addValue(0, count, last_value, literal_lengths, mNumLiterals, distance_lengths);
}
@ -142,7 +142,7 @@ void HuffmanStream::readCodeLengths()
mInputStream->readNextNBits(7, num_reps);
//std::cout << "Got val 18 doing " << 11 + num_reps << std::endl;
for(unsigned idx=0; idx< 11 + num_reps; idx++)
for(unsigned idx=0; idx< 11 + unsigned(num_reps); idx++)
{
addValue(0, count, last_value, literal_lengths, mNumLiterals, distance_lengths);
}
@ -172,7 +172,7 @@ void HuffmanStream::readCodeLengths()
void HuffmanStream::copyFromBuffer(unsigned length, unsigned distance)
{
unsigned offset = mBuffer.size() - 1 - distance;
std::size_t offset = mBuffer.size() - 1 - distance;
for(unsigned idx=0; idx<length; idx++)
{
auto symbol = mBuffer[offset + idx];
@ -327,7 +327,7 @@ void HuffmanStream::readCodingsTable()
unsigned char h_clen{0};
mInputStream->readNextNBits(4, h_clen);
auto num_code_lengths = h_clen + 4;
unsigned num_code_lengths = h_clen + 4;
//std::cout << "Got HCLEN " << num_code_lengths << std::endl;
auto sequence = std::vector<unsigned char>(num_code_lengths, 0);