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
998c7b2f
Commit
998c7b2f
authored
May 27, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed code so it throws the right type of exception.
parent
ddac90f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
save_png.h
dlib/image_saver/save_png.h
+5
-5
No files found.
dlib/image_saver/save_png.h
View file @
998c7b2f
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#define DLIB_SAVE_PnG_H__
#define DLIB_SAVE_PnG_H__
#include "save_png_abstract.h"
#include "save_png_abstract.h"
#include "
../image_loader/image_load
er.h"
#include "
image_sav
er.h"
#include "dlib/array2d.h"
#include "dlib/array2d.h"
#include "dlib/pixel.h"
#include "dlib/pixel.h"
#include <cstdio>
#include <cstdio>
...
@@ -62,7 +62,7 @@ namespace dlib
...
@@ -62,7 +62,7 @@ namespace dlib
/* Open the file */
/* Open the file */
fp
=
fopen
(
file_name
.
c_str
(),
"wb"
);
fp
=
fopen
(
file_name
.
c_str
(),
"wb"
);
if
(
fp
==
NULL
)
if
(
fp
==
NULL
)
throw
image_
load
_error
(
"Unable to open "
+
file_name
+
" for writing."
);
throw
image_
save
_error
(
"Unable to open "
+
file_name
+
" for writing."
);
/* Create and initialize the png_struct with the desired error handler
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
* functions. If you want to use the default stderr and longjump method,
...
@@ -75,7 +75,7 @@ namespace dlib
...
@@ -75,7 +75,7 @@ namespace dlib
if
(
png_ptr
==
NULL
)
if
(
png_ptr
==
NULL
)
{
{
fclose
(
fp
);
fclose
(
fp
);
throw
image_
load
_error
(
"Error while writing PNG file "
+
file_name
);
throw
image_
save
_error
(
"Error while writing PNG file "
+
file_name
);
}
}
/* Allocate/initialize the image information data. REQUIRED */
/* Allocate/initialize the image information data. REQUIRED */
...
@@ -84,7 +84,7 @@ namespace dlib
...
@@ -84,7 +84,7 @@ namespace dlib
{
{
fclose
(
fp
);
fclose
(
fp
);
png_destroy_write_struct
(
&
png_ptr
,
NULL
);
png_destroy_write_struct
(
&
png_ptr
,
NULL
);
throw
image_
load
_error
(
"Error while writing PNG file "
+
file_name
);
throw
image_
save
_error
(
"Error while writing PNG file "
+
file_name
);
}
}
/* Set error handling. REQUIRED if you aren't supplying your own
/* Set error handling. REQUIRED if you aren't supplying your own
...
@@ -95,7 +95,7 @@ namespace dlib
...
@@ -95,7 +95,7 @@ namespace dlib
/* If we get here, we had a problem writing the file */
/* If we get here, we had a problem writing the file */
fclose
(
fp
);
fclose
(
fp
);
png_destroy_write_struct
(
&
png_ptr
,
&
info_ptr
);
png_destroy_write_struct
(
&
png_ptr
,
&
info_ptr
);
throw
image_
load
_error
(
"Error while writing PNG file "
+
file_name
);
throw
image_
save
_error
(
"Error while writing PNG file "
+
file_name
);
}
}
...
...
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