bool ZLibFile::rawWrite(const void *buffer, size_t length)
{
- return gzwrite(m_gzFile, buffer, length) != -1;
+ return gzwrite(m_gzFile, buffer, unsigned(length)) != -1;
}
size_t ZLibFile::rawRead(void *buffer, size_t length)
{
- int ret = gzread(m_gzFile, buffer, length);
+ int ret = gzread(m_gzFile, buffer, unsigned(length));
return ret < 0 ? 0 : ret;
}
int ZLibFile::rawPercentRead()
{
gz_state *state = (gz_state *)m_gzFile;
- return 100 * (lseek(state->fd, 0, SEEK_CUR) / m_endOffset);
+ return int(100 * (lseek(state->fd, 0, SEEK_CUR) / m_endOffset));
}
File * File::createZLib(void) {
return new ZLibFile;
}
-
-bool File::isZLibCompressed(const std::string &filename)
-{
- std::fstream stream(filename.c_str(),
- std::fstream::binary | std::fstream::in);
- if (!stream.is_open())
- return false;
-
- unsigned char byte1, byte2;
- stream >> byte1;
- stream >> byte2;
- stream.close();
-
- return (byte1 == 0x1f && byte2 == 0x8b);
-}
-