]> git.cworth.org Git - apitrace/blobdiff - common/trace_file_zlib.cpp
image: Make PNG writing an Image method.
[apitrace] / common / trace_file_zlib.cpp
index 5d47d5387b366d472777f3577980386f06f80c2a..c4eed33dd2df650d9f63826981999b3498a500ad 100644 (file)
 #include <zlib.h>
 #include <gzguts.h>
 
+// for lseek
+#ifdef _WIN32
+#include <io.h>
+#else
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
 #include "os.hpp"
 
 #include <iostream>
@@ -60,7 +68,7 @@ protected:
     virtual bool rawSkip(size_t length);
     virtual int  rawPercentRead();
 private:
-    void *m_gzFile;
+    gzFile m_gzFile;
     double m_endOffset;
 };
 
@@ -149,19 +157,3 @@ int ZLibFile::rawPercentRead()
 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);
-}
-