X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_file_snappy.cpp;h=68673c6324ef5e28a9f0b79cf0f4e54f53bdcb63;hb=ce54daa47145e01b2b6ef6fdb13b28d6f9958933;hp=c0727cd28e86df4e54573e7094e7125cd91053a2;hpb=48412ffde3dd4710c96d5e8d9cfdf1789e4d703a;p=apitrace diff --git a/common/trace_file_snappy.cpp b/common/trace_file_snappy.cpp index c0727cd..68673c6 100644 --- a/common/trace_file_snappy.cpp +++ b/common/trace_file_snappy.cpp @@ -63,8 +63,6 @@ #define SNAPPY_CHUNK_SIZE (1 * 1024 * 1024) -#define SNAPPY_BYTE1 'a' -#define SNAPPY_BYTE2 't' using namespace trace; @@ -399,25 +397,10 @@ bool SnappyFile::rawSkip(size_t length) int SnappyFile::rawPercentRead() { - return 100 * (double(m_stream.tellg()) / double(m_endPos)); + return int(100 * (double(m_stream.tellg()) / double(m_endPos))); } File* File::createSnappy(void) { return new SnappyFile; } - -bool File::isSnappyCompressed(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 == SNAPPY_BYTE1 && byte2 == SNAPPY_BYTE2); -}