summaryrefslogtreecommitdiff
path: root/src/utils/MIODecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/MIODecoder.cpp')
-rw-r--r--src/utils/MIODecoder.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/utils/MIODecoder.cpp b/src/utils/MIODecoder.cpp
index 0a1698e..7574e55 100644
--- a/src/utils/MIODecoder.cpp
+++ b/src/utils/MIODecoder.cpp
@@ -1,14 +1,13 @@
#include "MIODecoder.h"
+#include <stdexcept>
extern "C" {
#include <libmio0/mio0.h>
}
-#include <stdexcept>
-#include <cstdint>
-std::unordered_map<uint32_t, std::vector<char>> MIO0Decoder::gCachedChunks;
+std::unordered_map<uint32_t, std::vector<uint8_t>> MIO0Decoder::gCachedChunks;
-std::vector<char>& MIO0Decoder::Decode(std::vector<uint8_t>& buffer, uint32_t offset) {
+std::vector<uint8_t>& MIO0Decoder::Decode(std::vector<uint8_t>& buffer, uint32_t offset) {
const unsigned char* in_buf = buffer.data() + offset;
mio0_header_t head;
@@ -16,9 +15,9 @@ std::vector<char>& MIO0Decoder::Decode(std::vector<uint8_t>& buffer, uint32_t of
throw std::runtime_error("Failed to decode MIO0 header");
}
- uint8_t* decompressed = new uint8_t[head.dest_size];
+ auto decompressed = new uint8_t[head.dest_size];
mio0_decode(in_buf, decompressed, nullptr);
- gCachedChunks[offset] = std::vector<char>(decompressed, decompressed + head.dest_size);
+ gCachedChunks[offset] = std::vector<uint8_t>(decompressed, decompressed + head.dest_size);
delete[] decompressed;
return gCachedChunks[offset];