exception.c revision bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6
13ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 23ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 33ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 43ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 53ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 63ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% EEEEE X X CCCC EEEEE PPPP TTTTT IIIII OOO N N % 73ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% E X X C E P P T I O O NN N % 83ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% EEE X C EEE PPPP T I O O N N N % 93ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% E X X C E P T I O O N NN % 103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% EEEEE X X CCCC EEEEE P T IIIII OOO N N % 113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickCore Exception Methods % 143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% Software Design % 163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% John Cristy % 173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% July 1993 % 183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2016af1cbdffcc02e7239d432e5fb51734fcf9f9ffcristy% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization % 213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% dedicated to making software imaging solutions freely available. % 223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% You may not use this file except in compliance with the License. You may % 243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% obtain a copy of the License at % 253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% http://www.imagemagick.org/script/license.php % 273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% Unless required by applicable law or agreed to in writing, software % 293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% distributed under the License is distributed on an "AS IS" BASIS, % 303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % 313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% See the License for the specific language governing permissions and % 323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% limitations under the License. % 333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy Include declarations. 423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/studio.h" 443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/client.h" 453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/exception.h" 463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/exception-private.h" 473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/hashmap.h" 483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/locale_.h" 493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/log.h" 503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/magick.h" 513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/memory_.h" 523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/string_.h" 533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "magick/utility.h" 543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy Forward declarations. 573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(__cplusplus) || defined(c_plusplus) 593ed852eea50f9d4cd633efb8c2b054b8e33c253cristyextern "C" { 603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 623ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void 633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultErrorHandler(const ExceptionType,const char *,const char *), 643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultFatalErrorHandler(const ExceptionType,const char *,const char *), 653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultWarningHandler(const ExceptionType,const char *,const char *); 663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(__cplusplus) || defined(c_plusplus) 683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy Global declarations. 733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 743ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic ErrorHandler 753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy error_handler = DefaultErrorHandler; 763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 773ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic FatalErrorHandler 783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy fatal_error_handler = DefaultFatalErrorHandler; 793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 803ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic WarningHandler 813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy warning_handler = DefaultWarningHandler; 823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A c q u i r e E x c e p t i o n I n f o % 893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% AcquireExceptionInfo() allocates the ExceptionInfo structure. 953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the AcquireExceptionInfo method is: 973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ExceptionInfo *AcquireExceptionInfo(void) 993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 1013ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ExceptionInfo *AcquireExceptionInfo(void) 1023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ExceptionInfo 1043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *exception; 1053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10690823213d62b0ba18557e61f1e6892c6fffd6cd4cristy exception=(ExceptionInfo *) AcquireAlignedMemory(1,sizeof(*exception)); 1073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception == (ExceptionInfo *) NULL) 1083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 1093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy GetExceptionInfo(exception); 1103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->relinquish=MagickTrue; 1113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(exception); 1123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 1153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% C l e a r M a g i c k E x c e p t i o n % 1203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ClearMagickException() clears any exception that may not have been caught 1263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% yet. 1273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ClearMagickException method is: 1293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ClearMagickException(ExceptionInfo *exception) 1313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 1333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 1353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 1373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1383ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void *DestroyExceptionElement(void *exception) 1393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 1413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 1423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) exception; 1443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p->reason != (char *) NULL) 1453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->reason=DestroyString(p->reason); 1463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p->description != (char *) NULL) 1473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->description=DestroyString(p->description); 1483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RelinquishMagickMemory(p); 1493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return((void *) NULL); 1503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1523ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void ClearMagickException(ExceptionInfo *exception) 1533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 1553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 1563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 1583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 1593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions == (void *) NULL) 1603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 161f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 1623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 1633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 1643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (ExceptionInfo *) NULL) 1653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 1663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) DestroyExceptionElement(p); 1673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 1683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 1693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 1703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 1713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->reason=(char *) NULL; 1723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->description=(char *) NULL; 173f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 1743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy errno=0; 1753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 1783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% C a t c h E x c e p t i o n % 1833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% CatchException() returns if no exceptions is found otherwise it reports 1893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% the exception as a warning, error, or fatal depending on the severity. 1903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the CatchException method is: 1923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% CatchException(ExceptionInfo *exception) 1943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 1963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 1983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 2003ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void CatchException(ExceptionInfo *exception) 2013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 2023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register const ExceptionInfo 2033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 2043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 2053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 2063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 2073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions == (void *) NULL) 2083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 209f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 2103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); 2113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 2123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 2133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (const ExceptionInfo *) NULL) 2143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 2153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p->severity >= WarningException) && (p->severity < ErrorException)) 2163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickWarning(p->severity,p->reason,p->description); 2173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p->severity >= ErrorException) && (p->severity < FatalErrorException)) 2183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickError(p->severity,p->reason,p->description); 21932cca407db0c7f1812b1809773513370b5813309cristy if (p->severity >= FatalErrorException) 2203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickFatalError(p->severity,p->reason,p->description); 2213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 2223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 2233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 224f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 2253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ClearMagickException(exception); 2263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 2273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 2283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 2293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t E r r o r H a n d l e r % 2343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultErrorHandler() displays an error reason. 2403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultErrorHandler method is: 2423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickError(const ExceptionType severity,const char *reason, 2443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 2453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 2473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 2493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 2513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 2523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 2543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 2563ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void DefaultErrorHandler(const ExceptionType magick_unused(severity), 2573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 2583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 2593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 2603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 2613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,"%s: %s",GetClientName(),reason); 2623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 2633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr," (%s)",description); 2643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,".\n"); 2653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 2663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 2673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 2683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 2693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t F a t a l E r r o r H a n d l e r % 2743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultFatalErrorHandler() displays an error reason and then terminates the 2803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 2813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultFatalErrorHandler method is: 2833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickFatalError(const ExceptionType severity,const char *reason, 2853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 2863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 2883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 2903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 2923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 2933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 2953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 2973ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void DefaultFatalErrorHandler( 2983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionType magick_unused(severity), 2993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 3003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 3013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 3023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 3033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,"%s: %s",GetClientName(),reason); 3043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 3053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr," (%s)",description); 3063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,".\n"); 3073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 3083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickCoreTerminus(); 3093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exit(1); 3103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t W a r n i n g H a n d l e r % 3183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultWarningHandler() displays a warning reason. 3243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultWarningHandler method is: 3263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3273b743bb1b7243007b41c2d143bd529c884069efccristy% void DefaultWarningHandler(const ExceptionType severity, 3283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *reason,const char *description) 3293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 3313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3323b743bb1b7243007b41c2d143bd529c884069efccristy% o severity: Specifies the numeric warning category. 3333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 3353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 3363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 3383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 3403ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void DefaultWarningHandler(const ExceptionType magick_unused(severity), 3413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 3423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 3433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 3443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 3453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,"%s: %s",GetClientName(),reason); 3463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 3473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr," (%s)",description); 3483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fprintf(stderr,".\n"); 3493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 3503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% D e s t r o y E x c e p t i o n I n f o % 3583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DestroyExceptionInfo() deallocates memory associated with an exception. 3643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DestroyExceptionInfo method is: 3663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) 3683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 3703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 3723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 3743ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) 3753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 3763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 3773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relinquish; 3783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 3803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 38178883b2620bba1a3572967ae6e04bcd5f42339d6cristy if (exception->semaphore == (SemaphoreInfo *) NULL) 38278883b2620bba1a3572967ae6e04bcd5f42339d6cristy AcquireSemaphoreInfo(&exception->semaphore); 383f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 3843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 3853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions != (void *) NULL) 3863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions=(void *) DestroyLinkedList((LinkedListInfo *) 3873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions,DestroyExceptionElement); 3883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relinquish=exception->relinquish; 3893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->relinquish != MagickFalse) 3903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->signature=(~MagickSignature); 391f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 3923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DestroySemaphoreInfo(&exception->semaphore); 3933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (relinquish != MagickFalse) 3943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception=(ExceptionInfo *) RelinquishMagickMemory(exception); 3953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(exception); 3963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% G e t E x c e p t i o n I n f o % 4043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionInfo() initializes an exception to default values. 4103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetExceptionInfo method is: 4123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionInfo(ExceptionInfo *exception) 4143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 4183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4203ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void GetExceptionInfo(ExceptionInfo *exception) 4213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 4233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ResetMagickMemory(exception,0,sizeof(*exception)); 4243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 4253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions=(void *) NewLinkedList(0); 42618b17443128598500357da7bff2f01683cf32890cristy exception->semaphore=AllocateSemaphoreInfo(); 4273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->signature=MagickSignature; 4283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 4293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 4313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% G e t E x c e p t i o n M e s s a g e % 4363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionMessage() returns the error message defined by the specified 4423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% error code. 4433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetExceptionMessage method is: 4453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% char *GetExceptionMessage(const int error) 4473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o error: the error code. 4513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4533ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport char *GetExceptionMessage(const int error) 4543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 4563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception[MaxTextExtent]; 4573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 458b56416944f1a142ac6fc387f125cbd3bf00ccd65cristy *exception='\0'; 4593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(MAGICKCORE_HAVE_STRERROR_R) 4603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) strerror_r(error,exception,sizeof(exception)); 4613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else 4623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) CopyMagickString(exception,strerror(error),sizeof(exception)); 4633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 4643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(ConstantString(exception)); 4653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 4663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 4683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% G e t L o c a l e E x c e p t i o n M e s s a g e % 4733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetLocaleExceptionMessage() converts a enumerated exception severity and tag 4793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% to a message in the current locale. 4803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetLocaleExceptionMessage method is: 4823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *GetLocaleExceptionMessage(const ExceptionType severity, 4843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *tag) 4853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: the severity of the exception. 4893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o tag: the message tag. 4913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4943ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic const char *ExceptionSeverityToTag(const ExceptionType severity) 4953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy switch (severity) 4973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 4983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitWarning: return("Resource/Limit/Warning/"); 4993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeWarning: return("Type/Warning/"); 5003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionWarning: return("Option/Warning/"); 5013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateWarning: return("Delegate/Warning/"); 5023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateWarning: return("Missing/Delegate/Warning/"); 5033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageWarning: return("Corrupt/Image/Warning/"); 5043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenWarning: return("File/Open/Warning/"); 5053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobWarning: return("Blob/Warning/"); 5063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamWarning: return("Stream/Warning/"); 5073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheWarning: return("Cache/Warning/"); 5083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderWarning: return("Coder/Warning/"); 509992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterWarning: return("Filter/Warning/"); 5103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleWarning: return("Module/Warning/"); 5113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawWarning: return("Draw/Warning/"); 5123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageWarning: return("Image/Warning/"); 5133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandWarning: return("Wand/Warning/"); 5143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerWarning: return("XServer/Warning/"); 5153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorWarning: return("Monitor/Warning/"); 5163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryWarning: return("Registry/Warning/"); 5173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureWarning: return("Configure/Warning/"); 5183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyWarning: return("Policy/Warning/"); 5193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitError: return("Resource/Limit/Error/"); 5203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeError: return("Type/Error/"); 5213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionError: return("Option/Error/"); 5223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateError: return("Delegate/Error/"); 5233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateError: return("Missing/Delegate/Error/"); 5243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageError: return("Corrupt/Image/Error/"); 5253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenError: return("File/Open/Error/"); 5263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobError: return("Blob/Error/"); 5273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamError: return("Stream/Error/"); 5283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheError: return("Cache/Error/"); 5293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderError: return("Coder/Error/"); 530992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterError: return("Filter/Error/"); 5313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleError: return("Module/Error/"); 5323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawError: return("Draw/Error/"); 5333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageError: return("Image/Error/"); 5343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandError: return("Wand/Error/"); 5353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerError: return("XServer/Error/"); 5363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorError: return("Monitor/Error/"); 5373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryError: return("Registry/Error/"); 5383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureError: return("Configure/Error/"); 5393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyError: return("Policy/Error/"); 5403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitFatalError: return("Resource/Limit/FatalError/"); 5413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeFatalError: return("Type/FatalError/"); 5423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionFatalError: return("Option/FatalError/"); 5433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateFatalError: return("Delegate/FatalError/"); 5443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateFatalError: return("Missing/Delegate/FatalError/"); 5453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageFatalError: return("Corrupt/Image/FatalError/"); 5463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenFatalError: return("File/Open/FatalError/"); 5473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobFatalError: return("Blob/FatalError/"); 5483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamFatalError: return("Stream/FatalError/"); 5493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheFatalError: return("Cache/FatalError/"); 5503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderFatalError: return("Coder/FatalError/"); 551992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterFatalError: return("Filter/FatalError/"); 5523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleFatalError: return("Module/FatalError/"); 5533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawFatalError: return("Draw/FatalError/"); 5543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageFatalError: return("Image/FatalError/"); 5553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandFatalError: return("Wand/FatalError/"); 5563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerFatalError: return("XServer/FatalError/"); 5573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorFatalError: return("Monitor/FatalError/"); 5583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryFatalError: return("Registry/FatalError/"); 5593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureFatalError: return("Configure/FatalError/"); 5603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyFatalError: return("Policy/FatalError/"); 5613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy default: break; 5623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 5633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(""); 5643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 5653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5663ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport const char *GetLocaleExceptionMessage(const ExceptionType severity, 5673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *tag) 5683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 5693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 5703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy message[MaxTextExtent]; 5713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char 5733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *locale_message; 5743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(tag != (const char *) NULL); 5763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) FormatMagickString(message,MaxTextExtent,"Exception/%s%s", 5773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ExceptionSeverityToTag(severity),tag); 5783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy locale_message=GetLocaleMessage(message); 5793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (locale_message == (const char *) NULL) 5803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(tag); 5813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (locale_message == message) 5823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(tag); 5833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(locale_message); 5843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 5853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 5873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% I n h e r i t E x c e p t i o n % 5923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% InheritException() inherits an exception from a related exception. 5983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the InheritException method is: 6003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% InheritException(ExceptionInfo *exception,const ExceptionInfo *relative) 6023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 6043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 6063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o relative: the related exception info. 6083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 6103ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void InheritException(ExceptionInfo *exception, 6113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionInfo *relative) 6123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 6133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register const ExceptionInfo 6143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 6153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 6173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 6183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(relative != (ExceptionInfo *) NULL); 6193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(relative->signature == MagickSignature); 6203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (relative->exceptions == (void *) NULL) 6213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 622f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 6233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); 6243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 6253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relative->exceptions); 6263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (const ExceptionInfo *) NULL) 6273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 6283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ThrowException(exception,p->severity,p->reason,p->description); 6293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 6303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relative->exceptions); 6313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 632f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 6333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 6343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 6363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k E r r o r % 6413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickError() calls the exception handler methods with an error reason. 6473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickError method is: 6493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickError(const ExceptionType error,const char *reason, 6513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 6523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 6543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: Specifies the numeric error category. 6563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 6583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 6593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 6613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 6633ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickError(const ExceptionType error,const char *reason, 6643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 6653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 6663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (error_handler != (ErrorHandler) NULL) 6673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*error_handler)(error,reason,description); 6683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 6693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 6713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k F a t al E r r o r % 6763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickFatalError() calls the fatal exception handler methods with an error 6823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% reason. 6833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickError method is: 6853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickFatalError(const ExceptionType error,const char *reason, 6873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 6883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 6903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: Specifies the numeric error category. 6923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 6943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 6953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 6973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 6993ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickFatalError(const ExceptionType error,const char *reason, 7003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 7013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (fatal_error_handler != (ErrorHandler) NULL) 7033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*fatal_error_handler)(error,reason,description); 7043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k W a r n i n g % 7123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickWarning() calls the warning handler methods with a warning reason. 7183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickWarning method is: 7203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickWarning(const ExceptionType warning,const char *reason, 7223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 7233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o warning: the warning severity. 7273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Define the reason for the warning. 7293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Describe the warning. 7313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7333ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickWarning(const ExceptionType warning,const char *reason, 7343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 7353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (warning_handler != (WarningHandler) NULL) 7373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*warning_handler)(warning,reason,description); 7383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t E r r o r H a n d l e r % 7463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetErrorHandler() sets the exception handler to the specified method 7523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% and returns the previous exception handler. 7533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetErrorHandler method is: 7553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetErrorHandler(ErrorHandler handler) 7573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle errors. 7613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7633ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ErrorHandler SetErrorHandler(ErrorHandler handler) 7643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ErrorHandler 7663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 7673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=error_handler; 7693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy error_handler=handler; 7703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 7713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t F a t a l E r r o r H a n d l e r % 7793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetFatalErrorHandler() sets the fatal exception handler to the specified 7853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% method and returns the previous fatal exception handler. 7863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetErrorHandler method is: 7883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetErrorHandler(ErrorHandler handler) 7903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle errors. 7943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7963ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport FatalErrorHandler SetFatalErrorHandler(FatalErrorHandler handler) 7973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy FatalErrorHandler 7993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 8003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=fatal_error_handler; 8023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy fatal_error_handler=handler; 8033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 8043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 8053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 8073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t W a r n i n g H a n d l e r % 8123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetWarningHandler() sets the warning handler to the specified method 8183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% and returns the previous warning handler. 8193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetWarningHandler method is: 8213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetWarningHandler(ErrorHandler handler) 8233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 8253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle warnings. 8273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 8293ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport WarningHandler SetWarningHandler(WarningHandler handler) 8303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 8313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy WarningHandler 8323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 8333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=warning_handler; 8353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy warning_handler=handler; 8363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 8373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 8383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 8403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% T h r o w E x c e p t i o n % 8453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ThrowException() throws an exception with the specified severity code, 8513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% reason, and optional description. 8523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ThrowException method is: 8543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickBooleanType ThrowException(ExceptionInfo *exception, 8563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const ExceptionType severity,const char *reason, 8573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 8583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 8603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 8623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: the severity of the exception. 8643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: the reason for the exception. 8663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: the exception description. 8683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 8703ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, 8713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionType severity,const char *reason,const char *description) 8723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 8733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 8743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 8753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 8773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 8783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) GetLastValueInLinkedList((LinkedListInfo *) 8793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 8803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p != (ExceptionInfo *) NULL) && (p->severity == severity) && 8813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (LocaleCompare(exception->reason,reason) == 0) && 8823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (LocaleCompare(exception->description,description) == 0)) 8833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(MagickTrue); 88490823213d62b0ba18557e61f1e6892c6fffd6cd4cristy p=(ExceptionInfo *) AcquireAlignedMemory(1,sizeof(*p)); 8853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p == (ExceptionInfo *) NULL) 8863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 8873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ResetMagickMemory(p,0,sizeof(*p)); 8883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->severity=severity; 8893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason != (const char *) NULL) 8903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->reason=ConstantString(reason); 8913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (const char *) NULL) 8923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->description=ConstantString(description); 8933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->signature=MagickSignature; 8943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) AppendValueToLinkedList((LinkedListInfo *) exception->exceptions,p); 8953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=p->severity; 8963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->reason=p->reason; 8973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->description=p->description; 8983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(MagickTrue); 8993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 9003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 9023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% T h r o w M a g i c k E x c e p t i o n % 9073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ThrowMagickException logs an exception as determined by the log configuration 9133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% file. If an error occurs, MagickFalse is returned otherwise MagickTrue. 9143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ThrowMagickException method is: 9163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickBooleanType ThrowFileException(ExceptionInfo *exception, 918bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy% const char *module,const char *function,const size_t line, 9193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const ExceptionType severity,const char *tag,const char *format,...) 9203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 9223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 9243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o filename: the source module filename. 9263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o function: the function name. 9283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o line: the line number of the source module. 9303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 9323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o tag: the locale tag. 9343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o format: the output format. 9363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 9383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9393ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport MagickBooleanType ThrowMagickExceptionList( 9403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ExceptionInfo *exception,const char *module,const char *function, 941bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy const size_t line,const ExceptionType severity,const char *tag, 9423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *format,va_list operands) 9433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 9443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 9453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy message[MaxTextExtent], 9463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy path[MaxTextExtent], 9473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy reason[MaxTextExtent]; 9483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char 95032cca407db0c7f1812b1809773513370b5813309cristy *locale, 95132cca407db0c7f1812b1809773513370b5813309cristy *type; 9523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy int 9543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n; 9553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 9573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status; 9583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy size_t 9603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy length; 9613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 9633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 9643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy locale=GetLocaleExceptionMessage(severity,tag); 9653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) CopyMagickString(reason,locale,MaxTextExtent); 9663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ConcatenateMagickString(reason," ",MaxTextExtent); 9673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy length=strlen(reason); 9683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(MAGICKCORE_HAVE_VSNPRINTF) 9693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n=vsnprintf(reason+length,MaxTextExtent-length,format,operands); 9703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else 9713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n=vsprintf(reason+length,format,operands); 9723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 9733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (n < 0) 9743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy reason[MaxTextExtent-1]='\0'; 9753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status=LogMagickEvent(ExceptionEvent,module,function,line,"%s",reason); 9763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy GetPathComponent(module,TailPath,path); 97732cca407db0c7f1812b1809773513370b5813309cristy type="undefined"; 97832cca407db0c7f1812b1809773513370b5813309cristy if ((severity >= WarningException) && (severity < ErrorException)) 97932cca407db0c7f1812b1809773513370b5813309cristy type="warning"; 98032cca407db0c7f1812b1809773513370b5813309cristy if ((severity >= ErrorException) && (severity < FatalErrorException)) 98132cca407db0c7f1812b1809773513370b5813309cristy type="error"; 98232cca407db0c7f1812b1809773513370b5813309cristy if (severity >= FatalErrorException) 98332cca407db0c7f1812b1809773513370b5813309cristy type="fatal"; 98432cca407db0c7f1812b1809773513370b5813309cristy (void) FormatMagickString(message,MaxTextExtent,"%s @ %s/%s/%s/%ld",reason, 98532cca407db0c7f1812b1809773513370b5813309cristy type,path,function,line); 9863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ThrowException(exception,severity,message,(char *) NULL); 9873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(status); 9883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 9893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9903ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, 991bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy const char *module,const char *function,const size_t line, 9923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionType severity,const char *tag,const char *format,...) 9933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 9943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 9953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status; 9963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_list 9983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy operands; 9993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_start(operands,format); 10013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status=ThrowMagickExceptionList(exception,module,function,line,severity,tag, 10023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy format,operands); 10033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_end(operands); 10043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(status); 10053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1006