X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_file_snappy.cpp;h=f47c89b046c37fe282478a9ca6a014bb108df553;hb=HEAD;hp=e4c17cd1755d7d2024e6a6fa4f30861912056436;hpb=76d6c051cd4ff8a631c378d09a670d93051025b4;p=apitrace diff --git a/common/trace_file_snappy.cpp b/common/trace_file_snappy.cpp index e4c17cd..f47c89b 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; @@ -241,7 +239,7 @@ size_t SnappyFile::rawRead(void *buffer, size_t length) int SnappyFile::rawGetc() { - int c = 0; + unsigned char c = 0; if (rawRead(&c, 1) != 1) return -1; return c; @@ -406,18 +404,3 @@ int SnappyFile::rawPercentRead() 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); -}