Browse Source

* Base.cpp : drop logger dependency

pull/536/head
hagen 9 years ago
parent
commit
02857cf2b5
  1. 17
      Base.cpp

17
Base.cpp

@ -1,5 +1,4 @@
#include <stdlib.h> #include <stdlib.h>
#include "Log.h"
#include "Base.h" #include "Base.h"
namespace i2p namespace i2p
@ -305,13 +304,10 @@ namespace data
m_Inflator.next_out = out; m_Inflator.next_out = out;
m_Inflator.avail_out = outLen; m_Inflator.avail_out = outLen;
int err; int err;
if ((err = inflate (&m_Inflator, Z_NO_FLUSH)) == Z_STREAM_END) if ((err = inflate (&m_Inflator, Z_NO_FLUSH)) == Z_STREAM_END) {
return outLen - m_Inflator.avail_out; return outLen - m_Inflator.avail_out;
else
{
LogPrint (eLogError, "Decompression error ", err);
return 0;
} }
return 0;
} }
bool GzipInflator::Inflate (const uint8_t * in, size_t inLen, std::ostream& s) bool GzipInflator::Inflate (const uint8_t * in, size_t inLen, std::ostream& s)
@ -328,12 +324,10 @@ namespace data
ret = inflate (&m_Inflator, Z_NO_FLUSH); ret = inflate (&m_Inflator, Z_NO_FLUSH);
if (ret < 0) if (ret < 0)
{ {
LogPrint (eLogError, "Decompression error ", ret);
inflateEnd (&m_Inflator); inflateEnd (&m_Inflator);
s.setstate(std::ios_base::failbit); s.setstate(std::ios_base::failbit);
break; break;
} }
else
s.write ((char *)out, GZIP_CHUNK_SIZE - m_Inflator.avail_out); s.write ((char *)out, GZIP_CHUNK_SIZE - m_Inflator.avail_out);
} }
while (!m_Inflator.avail_out); // more data to read while (!m_Inflator.avail_out); // more data to read
@ -377,14 +371,11 @@ namespace data
m_Deflator.next_out = out; m_Deflator.next_out = out;
m_Deflator.avail_out = outLen; m_Deflator.avail_out = outLen;
int err; int err;
if ((err = deflate (&m_Deflator, Z_FINISH)) == Z_STREAM_END) if ((err = deflate (&m_Deflator, Z_FINISH)) == Z_STREAM_END) {
return outLen - m_Deflator.avail_out; return outLen - m_Deflator.avail_out;
else } /* else */
{
LogPrint (eLogError, "Compression error ", err);
return 0; return 0;
} }
} }
} }
}

Loading…
Cancel
Save