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
998c7b2f
"docs/basic_usage/native_api.ipynb" did not exist on "73dcf2b326ca75b8dbcfcf07922f9859ab97830d"
Commit
998c7b2f
authored
May 27, 2011
by
Davis King
Browse files
Fixed code so it throws the right type of exception.
parent
ddac90f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
dlib/image_saver/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