X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_file_zlib.cpp;h=a432ccde44598984f2503ff4a68e304a723ec54d;hb=d6b7eb6b7c8280762fb635a6e63aa3a426694ed7;hp=5e5d5deb9561acf4e33de20c99390cbbc2aa4708;hpb=97ac28e65ca20b5649552597afaeee1d67766f6a;p=apitrace diff --git a/common/trace_file_zlib.cpp b/common/trace_file_zlib.cpp index 5e5d5de..a432ccd 100644 --- a/common/trace_file_zlib.cpp +++ b/common/trace_file_zlib.cpp @@ -105,12 +105,12 @@ bool ZLibFile::rawOpen(const std::string &filename, File::Mode mode) 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; } @@ -150,26 +150,10 @@ bool ZLibFile::rawSkip(size_t) 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); -} -