Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.image
Commits
077a7ca5
Commit
077a7ca5
authored
Sep 09, 2016
by
Manuel Günther
Browse files
Removed static variable in get_correct_image_extension to avoid race conditions
parent
ce3adfe9
Pipeline
#3639
passed with stages
in 48 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/image/cpp/image.cpp
View file @
077a7ca5
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment