internal int SetParams(CompressionLevel level, CompressionStrategy strategy)
{
int result = ZlibConstants.Z_OK;
if (compressionLevel != level)
{
Config newConfig = Config.Lookup(level);
// change in the deflate flavor (Fast vs slow vs none)?
if (newConfig.Flavor != config.Flavor && _codec.TotalBytesIn != 0)
{
// Flush the last buffer:
result = _codec.Deflate(FlushType.Partial);
}
compressionLevel = level;
config = newConfig;
SetDeflater();
}
// no need to flush with change in strategy? Really?
compressionStrategy = strategy;
return result;
}