Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
a40a5c6e
Commit
a40a5c6e
authored
May 20, 2019
by
VirgileD
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a comprehensive error message when jpeg loading fails.
parent
dedb7358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
jpeg_loader.cpp
dlib/image_loader/jpeg_loader.cpp
+5
-1
No files found.
dlib/image_loader/jpeg_loader.cpp
View file @
a40a5c6e
...
...
@@ -81,12 +81,16 @@ namespace dlib
{
jpeg_error_mgr
pub
;
/* "public" fields */
jmp_buf
setjmp_buffer
;
/* for return to caller */
char
jpegLastErrorMsg
[
JMSG_LENGTH_MAX
];
};
void
jpeg_loader_error_exit
(
j_common_ptr
cinfo
)
{
/* cinfo->err really points to a jpeg_loader_error_mgr struct, so coerce pointer */
jpeg_loader_error_mgr
*
myerr
=
(
jpeg_loader_error_mgr
*
)
cinfo
->
err
;
/* Create the message */
(
*
(
cinfo
->
err
->
format_message
)
)
(
cinfo
,
myerr
->
jpegLastErrorMsg
);
/* Return control to the setjmp point */
longjmp
(
myerr
->
setjmp_buffer
,
1
);
...
...
@@ -127,7 +131,7 @@ namespace dlib
*/
jpeg_destroy_decompress
(
&
cinfo
);
if
(
file
!=
NULL
)
fclose
(
file
);
throw
image_load_error
(
std
::
string
(
"jpeg_loader: error while loading image
"
)
);
throw
image_load_error
(
std
::
string
(
"jpeg_loader: error while loading image
: "
)
+
jerr
.
jpegLastErrorMsg
);
}
...
...
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