]> granicus.if.org Git - imagemagick/blob - www/api/exception.html
Clone the image->image_info structure to prevent a dangling pointer
[imagemagick] / www / api / exception.html
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4   
5     <title>ImageMagick: MagickCore, C API for ImageMagick: Dealing with Exceptions</title>
6   <meta http-equiv="content-type" content="text/html; charset=utf-8">
7   <meta name="application-name" content="ImageMagick">
8   <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
9   <meta name="application-url" content="http://www.imagemagick.org">
10   <meta name="generator" content="PHP">
11   <meta name="keywords" content="magickcore, c, api, for, imagemagick:, dealing, with, exceptions, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
12   <meta name="rating" content="GENERAL">
13   <meta name="robots" content="INDEX, FOLLOW">
14   <meta name="generator" content="ImageMagick Studio LLC">
15   <meta name="author" content="ImageMagick Studio LLC">
16   <meta name="revisit-after" content="2 DAYS">
17   <meta name="resource-type" content="document">
18   <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
19   <meta name="distribution" content="Global">
20   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
21   <link rel="icon" href="../images/wand.png">
22   <link rel="shortcut icon" href="../images/wand.ico">
23   <link rel="stylesheet" href="../css/magick.html">
24 </head>
25 <body>
26 <div class="main">
27 <div class="magick-masthead">
28   <div class="container">
29     <script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-ad-format="auto"></ins>
30     <script>
31     (adsbygoogle = window.adsbygoogle || []).push({});
32     </script>
33     <nav class="magick-nav">
34       <a class="magick-nav-item " href="../index.html">Home</a>
35       <a class="magick-nav-item " href="../binary-releases.html">Download</a>
36       <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
37       <a class="magick-nav-item " href="../command-line-options.html">Options</a>
38       <a class="magick-nav-item " href="../resources.html">Resources</a>
39       <a class="magick-nav-item " href="api.html">Develop</a>
40       <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
41       <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
42     </nav>
43   </div>
44 </div>
45 <div class="container">
46 <div class="magick-header">
47 <p class="text-center"><a href="exception.html#AcquireExceptionInfo">AcquireExceptionInfo</a> • <a href="exception.html#ClearMagickException">ClearMagickException</a> • <a href="exception.html#CatchException">CatchException</a> • <a href="exception.html#CloneExceptionInfo">CloneExceptionInfo</a> • <a href="exception.html#DestroyExceptionInfo">DestroyExceptionInfo</a> • <a href="exception.html#GetExceptionMessage">GetExceptionMessage</a> • <a href="exception.html#GetLocaleExceptionMessage">GetLocaleExceptionMessage</a> • <a href="exception.html#InheritException">InheritException</a> • <a href="exception.html#InitializeExceptionInfo">InitializeExceptionInfo</a> • <a href="exception.html#MagickError">MagickError</a> • <a href="exception.html#MagickFatalError">MagickFatalError</a> • <a href="exception.html#MagickWarning">MagickWarning</a> • <a href="exception.html#SetErrorHandler">SetErrorHandler</a> • <a href="exception.html#SetFatalErrorHandler">SetFatalErrorHandler</a> • <a href="exception.html#SetWarningHandler">SetWarningHandler</a> • <a href="exception.html#ThrowException">ThrowException</a></p>
48
49 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="AcquireExceptionInfo">AcquireExceptionInfo</a></h2>
50
51 <p>AcquireExceptionInfo() allocates the ExceptionInfo structure.</p>
52
53 <p>The format of the AcquireExceptionInfo method is:</p>
54
55 <pre class="text">
56 ExceptionInfo *AcquireExceptionInfo(void)
57 </pre>
58
59 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ClearMagickException">ClearMagickException</a></h2>
60
61 <p>ClearMagickException() clears any exception that may not have been caught yet.</p>
62
63 <p>The format of the ClearMagickException method is:</p>
64
65 <pre class="text">
66 ClearMagickException(ExceptionInfo *exception)
67 </pre>
68
69 <p>A description of each parameter follows:</p>
70
71 <dd>
72 </dd>
73
74 <dd> </dd>
75 <dl class="dl-horizontal">
76 <dt>exception</dt>
77 <dd>the exception info. </dd>
78
79 <dd>  </dd>
80 </dl>
81 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CatchException">CatchException</a></h2>
82
83 <p>CatchException() returns if no exceptions is found otherwise it reports the exception as a warning, error, or fatal depending on the severity.</p>
84
85 <p>The format of the CatchException method is:</p>
86
87 <pre class="text">
88 CatchException(ExceptionInfo *exception)
89 </pre>
90
91 <p>A description of each parameter follows:</p>
92
93 <dd>
94 </dd>
95
96 <dd> </dd>
97 <dl class="dl-horizontal">
98 <dt>exception</dt>
99 <dd>the exception info. </dd>
100
101 <dd>  </dd>
102 </dl>
103 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="CloneExceptionInfo">CloneExceptionInfo</a></h2>
104
105 <p>CloneExceptionInfo() clones the ExceptionInfo structure.</p>
106
107 <p>The format of the CloneExceptionInfo method is:</p>
108
109 <pre class="text">
110 ExceptionInfo *CloneException(ExceptionInfo *exception)
111 </pre>
112
113 <p>A description of each parameter follows:</p>
114
115 <dd>
116 </dd>
117
118 <dd> </dd>
119 <dl class="dl-horizontal">
120 <dt>exception</dt>
121 <dd>the exception info. </dd>
122
123 <dd>  </dd>
124 </dl>
125 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="DestroyExceptionInfo">DestroyExceptionInfo</a></h2>
126
127 <p>DestroyExceptionInfo() deallocates memory associated with an exception.</p>
128
129 <p>The format of the DestroyExceptionInfo method is:</p>
130
131 <pre class="text">
132 ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception)
133 </pre>
134
135 <p>A description of each parameter follows:</p>
136
137 <dd>
138 </dd>
139
140 <dd> </dd>
141 <dl class="dl-horizontal">
142 <dt>exception</dt>
143 <dd>the exception info. </dd>
144
145 <dd>  </dd>
146 </dl>
147 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetExceptionMessage">GetExceptionMessage</a></h2>
148
149 <p>GetExceptionMessage() returns the error message defined by the specified error code.</p>
150
151 <p>The format of the GetExceptionMessage method is:</p>
152
153 <pre class="text">
154 char *GetExceptionMessage(const int error)
155 </pre>
156
157 <p>A description of each parameter follows:</p>
158
159 <dd>
160 </dd>
161
162 <dd> </dd>
163 <dl class="dl-horizontal">
164 <dt>error</dt>
165 <dd>the error code. </dd>
166
167 <dd>  </dd>
168 </dl>
169 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="GetLocaleExceptionMessage">GetLocaleExceptionMessage</a></h2>
170
171 <p>GetLocaleExceptionMessage() converts a enumerated exception severity and tag to a message in the current locale.</p>
172
173 <p>The format of the GetLocaleExceptionMessage method is:</p>
174
175 <pre class="text">
176 const char *GetLocaleExceptionMessage(const ExceptionType severity,
177   const char *tag)
178 </pre>
179
180 <p>A description of each parameter follows:</p>
181
182 <dd>
183 </dd>
184
185 <dd> </dd>
186 <dl class="dl-horizontal">
187 <dt>severity</dt>
188 <dd>the severity of the exception. </dd>
189
190 <dd> </dd>
191 <dt>tag</dt>
192 <dd>the message tag. </dd>
193
194 <dd>  </dd>
195 </dl>
196 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InheritException">InheritException</a></h2>
197
198 <p>InheritException() inherits an exception from a related exception.</p>
199
200 <p>The format of the InheritException method is:</p>
201
202 <pre class="text">
203 InheritException(ExceptionInfo *exception,const ExceptionInfo *relative)
204 </pre>
205
206 <p>A description of each parameter follows:</p>
207
208 <dd>
209 </dd>
210
211 <dd> </dd>
212 <dl class="dl-horizontal">
213 <dt>exception</dt>
214 <dd>the exception info. </dd>
215
216 <dd> </dd>
217 <dt>relative</dt>
218 <dd>the related exception info. </dd>
219
220 <dd>  </dd>
221 </dl>
222 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="InitializeExceptionInfo">InitializeExceptionInfo</a></h2>
223
224 <p>InitializeExceptionInfo() initializes an exception to default values.</p>
225
226 <p>The format of the InitializeExceptionInfo method is:</p>
227
228 <pre class="text">
229 InitializeExceptionInfo(ExceptionInfo *exception)
230 </pre>
231
232 <p>A description of each parameter follows:</p>
233
234 <dd>
235 </dd>
236
237 <dd> </dd>
238 <dl class="dl-horizontal">
239 <dt>exception</dt>
240 <dd>the exception info. </dd>
241
242 <dd>  </dd>
243 </dl>
244 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickError">MagickError</a></h2>
245
246 <p>MagickError() calls the exception handler methods with an error reason.</p>
247
248 <p>The format of the MagickError method is:</p>
249
250 <pre class="text">
251 void MagickError(const ExceptionType error,const char *reason,
252   const char *description)
253 </pre>
254
255 <p>A description of each parameter follows:</p>
256
257 <dd>
258 </dd>
259
260 <dd> </dd>
261 <dl class="dl-horizontal">
262 <dt>exception</dt>
263 <dd>Specifies the numeric error category. </dd>
264
265 <dd> </dd>
266 <dt>reason</dt>
267 <dd>Specifies the reason to display before terminating the program. </dd>
268
269 <dd> </dd>
270 <dt>description</dt>
271 <dd>Specifies any description to the reason. </dd>
272
273 <dd>  </dd>
274 </dl>
275 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickFatalError">MagickFatalError</a></h2>
276
277 <p>MagickFatalError() calls the fatal exception handler methods with an error reason.</p>
278
279 <p>The format of the MagickError method is:</p>
280
281 <pre class="text">
282 void MagickFatalError(const ExceptionType error,const char *reason,
283   const char *description)
284 </pre>
285
286 <p>A description of each parameter follows:</p>
287
288 <dd>
289 </dd>
290
291 <dd> </dd>
292 <dl class="dl-horizontal">
293 <dt>exception</dt>
294 <dd>Specifies the numeric error category. </dd>
295
296 <dd> </dd>
297 <dt>reason</dt>
298 <dd>Specifies the reason to display before terminating the program. </dd>
299
300 <dd> </dd>
301 <dt>description</dt>
302 <dd>Specifies any description to the reason. </dd>
303
304 <dd>  </dd>
305 </dl>
306 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="MagickWarning">MagickWarning</a></h2>
307
308 <p>MagickWarning() calls the warning handler methods with a warning reason.</p>
309
310 <p>The format of the MagickWarning method is:</p>
311
312 <pre class="text">
313 void MagickWarning(const ExceptionType warning,const char *reason,
314   const char *description)
315 </pre>
316
317 <p>A description of each parameter follows:</p>
318
319 <dd>
320 </dd>
321
322 <dd> </dd>
323 <dl class="dl-horizontal">
324 <dt>warning</dt>
325 <dd>the warning severity. </dd>
326
327 <dd> </dd>
328 <dt>reason</dt>
329 <dd>Define the reason for the warning. </dd>
330
331 <dd> </dd>
332 <dt>description</dt>
333 <dd>Describe the warning. </dd>
334
335 <dd>  </dd>
336 </dl>
337 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetErrorHandler">SetErrorHandler</a></h2>
338
339 <p>SetErrorHandler() sets the exception handler to the specified method and returns the previous exception handler.</p>
340
341 <p>The format of the SetErrorHandler method is:</p>
342
343 <pre class="text">
344 ErrorHandler SetErrorHandler(ErrorHandler handler)
345 </pre>
346
347 <p>A description of each parameter follows:</p>
348
349 <dd>
350 </dd>
351
352 <dd> </dd>
353 <dl class="dl-horizontal">
354 <dt>handler</dt>
355 <dd>the method to handle errors. </dd>
356
357 <dd>  </dd>
358 </dl>
359 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetFatalErrorHandler">SetFatalErrorHandler</a></h2>
360
361 <p>SetFatalErrorHandler() sets the fatal exception handler to the specified method and returns the previous fatal exception handler.</p>
362
363 <p>The format of the SetErrorHandler method is:</p>
364
365 <pre class="text">
366 ErrorHandler SetErrorHandler(ErrorHandler handler)
367 </pre>
368
369 <p>A description of each parameter follows:</p>
370
371 <dd>
372 </dd>
373
374 <dd> </dd>
375 <dl class="dl-horizontal">
376 <dt>handler</dt>
377 <dd>the method to handle errors. </dd>
378
379 <dd>  </dd>
380 </dl>
381 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="SetWarningHandler">SetWarningHandler</a></h2>
382
383 <p>SetWarningHandler() sets the warning handler to the specified method and returns the previous warning handler.</p>
384
385 <p>The format of the SetWarningHandler method is:</p>
386
387 <pre class="text">
388 ErrorHandler SetWarningHandler(ErrorHandler handler)
389 </pre>
390
391 <p>A description of each parameter follows:</p>
392
393 <dd>
394 </dd>
395
396 <dd> </dd>
397 <dl class="dl-horizontal">
398 <dt>handler</dt>
399 <dd>the method to handle warnings. </dd>
400
401 <dd>  </dd>
402 </dl>
403 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/exception_8c.html" id="ThrowException">ThrowException</a></h2>
404
405 <p>ThrowException() throws an exception with the specified severity code, reason, and optional description.</p>
406
407 <p>The format of the ThrowException method is:</p>
408
409 <pre class="text">
410 MagickBooleanType ThrowException(ExceptionInfo *exception,
411   const ExceptionType severity,const char *reason,
412   const char *description)
413 </pre>
414
415 <p>A description of each parameter follows:</p>
416
417 <dd>
418 </dd>
419
420 <dd> </dd>
421 <dl class="dl-horizontal">
422 <dt>exception</dt>
423 <dd>the exception info. </dd>
424
425 <dd> </dd>
426 <dt>severity</dt>
427 <dd>the severity of the exception. </dd>
428
429 <dd> </dd>
430 <dt>reason</dt>
431 <dd>the reason for the exception. </dd>
432
433 <dd> </dd>
434 <dt>description</dt>
435 <dd>the exception description. </dd>
436
437 <dd>  </dd>
438 </dl>
439 </div>
440   <footer class="magick-footer">
441     <p><a href="../support.html">Donate</a> •
442      <a href="../sitemap.html">Sitemap</a> •
443     <a href="../links.html">Related</a> •
444     <a href="../architecture.html">Architecture</a>
445 </p>
446     <p><a href="exception.html#">Back to top</a> •
447     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
448     <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
449         <p><small>©  1999-2015 ImageMagick Studio LLC</small></p>
450   </footer>
451 </div><!-- /.container -->
452
453   <script src="http://nextgen.imagemagick.org/js/magick.html"></script>
454 </div>
455 </body>
456 </html>