]> git.cworth.org Git - apitrace/blobdiff - trace_parser.hpp
Link against X11 libraries.
[apitrace] / trace_parser.hpp
index 04dfd866f331b1afe5ff0bad77a63e340c174a5e..edd968510bb969769e629650cbfcf8ed9acbb86d 100644 (file)
@@ -60,7 +60,7 @@ protected:
     typedef std::vector<Struct::Signature *> StructMap;
     StructMap structs;
 
-    typedef std::vector<Enum *> EnumMap;
+    typedef std::vector<Enum::Signature *> EnumMap;
     EnumMap enums;
 
     typedef std::vector<Bitmask::Signature *> BitmaskMap;
@@ -69,6 +69,8 @@ protected:
     unsigned next_call_no;
 
 public:
+    static unsigned long long version;
+
     Parser() {
         file = NULL;
         next_call_no = 0;
@@ -79,15 +81,13 @@ public:
     }
 
     bool open(const char *filename) {
-        unsigned long long version;
-
         file = gzopen(filename, "rb");
         if (!file) {
             return false;
         }
 
         version = read_uint();
-        if (version != TRACE_VERSION) {
+        if (version > TRACE_VERSION) {
             std::cerr << "error: unsupported format version" << version << "\n";
             return false;
         }
@@ -275,15 +275,15 @@ public:
 
     Value *parse_enum() {
         size_t id = read_uint();
-        Enum *sig = lookup(enums, id);
+        Enum::Signature *sig = lookup(enums, id);
         if (!sig) {
             std::string name = read_string();
             Value *value = parse_value();
-            sig = new Enum(name, value);
+            sig = new Enum::Signature(name, value);
             enums[id] = sig;
         }
         assert(sig);
-        return sig;
+        return new Enum(sig);
     }
 
     Value *parse_bitmask() {
@@ -319,7 +319,7 @@ public:
         size_t size = read_uint();
         Blob *blob = new Blob(size);
         if (size) {
-            gzread(file, blob->buf, size);
+            gzread(file, blob->buf, (unsigned)size);
         }
         return blob;
     }
@@ -351,8 +351,7 @@ public:
     Value *parse_opaque() {
         unsigned long long addr;
         addr = read_uint();
-        /* XXX */
-        return new UInt(addr);
+        return new Pointer(addr);
     }
 
     std::string read_string(void) {
@@ -361,7 +360,7 @@ public:
             return std::string();
         }
         char * buf = new char[len];
-        gzread(file, buf, len);
+        gzread(file, buf, (unsigned)len);
         std::string value(buf, len);
         delete [] buf;
 #if TRACE_VERBOSE