Skip to content
Snippets Groups Projects
Commit 077a7ca5 authored by Manuel Günther's avatar Manuel Günther
Browse files

Removed static variable in get_correct_image_extension to avoid race conditions

parent ce3adfe9
Branches
Tags
1 merge request!17Resolve "Load images based on magic numbers instead of filename extension in C++"
Pipeline #
......@@ -56,7 +56,7 @@ static std::map<std::string, std::vector<std::vector<std::uint8_t>>> known_magic
const std::string& get_correct_image_extension(const std::string& image_name){
// read first 8 bytes from file
static uint8_t image_bytes[8];
uint8_t image_bytes[8];
std::ifstream f(image_name);
if (!f) throw std::runtime_error("The given image '" + image_name + "' could not be opened for reading");
f.read(reinterpret_cast<char*>(image_bytes), 8);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment