summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-07-29 19:41:36 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-07-29 19:41:36 +0200
commite28b51eb937a54476de9673fe0759a95a889eac9 (patch)
tree95e0756f6cbefb4d131bae86d2f4138d8361b197
parent1d6b4708c0093256ee67cc4c8ba1982719243b6d (diff)
Modify saved packages format to include a header
-rw-r--r--src/monitor-gui.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc
index 3419025..f3e6b70 100644
--- a/src/monitor-gui.cc
+++ b/src/monitor-gui.cc
@@ -1357,7 +1357,7 @@ private:
}
uint8_t header[8];
in.read(reinterpret_cast<char*>(header), 8);
- if (!in.good() || read_u32(header) != 1) {
+ if (!in.good() || memcmp(header, "TPP", 3) || header[3] != 1) {
show_error("Not a valid package file: " +file);
return false;
}
@@ -1428,7 +1428,8 @@ private:
return false;
}
uint8_t header[8];
- write_u32(header, 1); // Version
+ memcpy(header, "TPP", 3);
+ header[3] = 0x1; // Version
write_u32(header + 4, packages->rows()); // Count
out.write(reinterpret_cast<char*>(header), 8);
for (size_t i = 0; i < packages->rows(); ++i) {