Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
999306e1
Commit
999306e1
authored
Jul 22, 2017
by
Davis King
Browse files
Improved errors from libpng when users link against a different version of
libpng than they built against.
parent
1f5335c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
dlib/image_loader/png_loader.cpp
dlib/image_loader/png_loader.cpp
+12
-1
No files found.
dlib/image_loader/png_loader.cpp
View file @
999306e1
...
...
@@ -13,6 +13,8 @@
#include <png.h>
#include "../string.h"
#include "../byte_orderer.h"
#include <sstream>
#include <cstring>
namespace
dlib
{
...
...
@@ -133,7 +135,16 @@ namespace dlib
if
(
ld_
->
png_ptr_
==
NULL
)
{
fclose
(
fp
);
throw
image_load_error
(
std
::
string
(
"png_loader: parse error in file "
)
+
filename
);
std
::
ostringstream
sout
;
sout
<<
"Error, unable to allocate png structure while opening file "
<<
filename
<<
std
::
endl
;
const
char
*
runtime_version
=
png_get_header_ver
(
NULL
);
if
(
runtime_version
&&
std
::
strcmp
(
PNG_LIBPNG_VER_STRING
,
runtime_version
)
!=
0
)
{
sout
<<
"This is happening because you compiled against one version of libpng, but then linked to another."
<<
std
::
endl
;
sout
<<
"Compiled against libpng version: "
<<
PNG_LIBPNG_VER_STRING
<<
std
::
endl
;
sout
<<
"Linking to this version of libpng: "
<<
runtime_version
<<
std
::
endl
;
}
throw
image_load_error
(
sout
.
str
());
}
ld_
->
info_ptr_
=
png_create_info_struct
(
ld_
->
png_ptr_
);
if
(
ld_
->
info_ptr_
==
NULL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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