exception.c revision 4592b2c7a40c37efd17aaa688be0d18fe953bd8f
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 % 16de984cdc3631106b1cbbb8d3972b76a0fc27e8e8cristy% Cristy % 173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% July 1993 % 183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 20fe676ee3a9cf43404bdc9ba8b27f597b5e4e28f7cristy% Copyright 1999-2014 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*/ 434c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/studio.h" 444c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/client.h" 454c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/exception.h" 464c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/exception-private.h" 474c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/hashmap.h" 484c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/locale_.h" 494c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/log.h" 504c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/magick.h" 514c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/memory_.h" 524c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/string_.h" 534c08aed51c5899665ade97263692328eea4af106cristy#include "MagickCore/utility.h" 54d1dd6e4fefa0810b9893e6ac9418f79c97c1b39acristy#include "MagickCore/utility-private.h" 553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy Forward declarations. 583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(__cplusplus) || defined(c_plusplus) 603ed852eea50f9d4cd633efb8c2b054b8e33c253cristyextern "C" { 613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 633ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void 643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultErrorHandler(const ExceptionType,const char *,const char *), 653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultFatalErrorHandler(const ExceptionType,const char *,const char *), 663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DefaultWarningHandler(const ExceptionType,const char *,const char *); 673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(__cplusplus) || defined(c_plusplus) 693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy Global declarations. 743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 753ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic ErrorHandler 763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy error_handler = DefaultErrorHandler; 773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 783ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic FatalErrorHandler 793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy fatal_error_handler = DefaultFatalErrorHandler; 803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 813ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic WarningHandler 823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy warning_handler = DefaultWarningHandler; 833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A c q u i r e E x c e p t i o n I n f o % 903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% AcquireExceptionInfo() allocates the ExceptionInfo structure. 963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the AcquireExceptionInfo method is: 983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ExceptionInfo *AcquireExceptionInfo(void) 1003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 1023ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ExceptionInfo *AcquireExceptionInfo(void) 1033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ExceptionInfo 1053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *exception; 1063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10773bd4a51b419e914565bdf204bf1540dc4c8ee26cristy exception=(ExceptionInfo *) AcquireMagickMemory(sizeof(*exception)); 1083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception == (ExceptionInfo *) NULL) 1093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 1103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy GetExceptionInfo(exception); 1113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->relinquish=MagickTrue; 1123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(exception); 1133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 1163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% C l e a r M a g i c k E x c e p t i o n % 1213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ClearMagickException() clears any exception that may not have been caught 1273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% yet. 1283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ClearMagickException method is: 1303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ClearMagickException(ExceptionInfo *exception) 1323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 1343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 1363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 1383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1393ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void *DestroyExceptionElement(void *exception) 1403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 1423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 1433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) exception; 1453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p->reason != (char *) NULL) 1463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->reason=DestroyString(p->reason); 1473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p->description != (char *) NULL) 1483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->description=DestroyString(p->description); 1493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RelinquishMagickMemory(p); 1503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return((void *) NULL); 1513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1533ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void ClearMagickException(ExceptionInfo *exception) 1543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 1553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 1563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 1573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 1593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 1603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions == (void *) NULL) 1613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 162f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 1633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 1643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 1653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (ExceptionInfo *) NULL) 1663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 1673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) DestroyExceptionElement(p); 1683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) 1693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 1703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 1713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 1723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->reason=(char *) NULL; 1733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->description=(char *) NULL; 174f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 1753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy errno=0; 1763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 1783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 1793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% C a t c h E x c e p t i o n % 1843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 1873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% CatchException() returns if no exceptions is found otherwise it reports 1903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% the exception as a warning, error, or fatal depending on the severity. 1913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the CatchException method is: 1933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% CatchException(ExceptionInfo *exception) 1953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 1973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 1983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 1993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 2013ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void CatchException(ExceptionInfo *exception) 2023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 2033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register const ExceptionInfo 2043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 2053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 2063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 2073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 2083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions == (void *) NULL) 2093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 210f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 2113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); 2123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 2133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 2143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (const ExceptionInfo *) NULL) 2153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 2163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p->severity >= WarningException) && (p->severity < ErrorException)) 2173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickWarning(p->severity,p->reason,p->description); 2183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p->severity >= ErrorException) && (p->severity < FatalErrorException)) 2193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickError(p->severity,p->reason,p->description); 22032cca407db0c7f1812b1809773513370b5813309cristy if (p->severity >= FatalErrorException) 2213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickFatalError(p->severity,p->reason,p->description); 2223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 2233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 2243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 225f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 2263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ClearMagickException(exception); 2273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 2283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 2293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 2303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 231c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 232c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 233c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 234c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% C l o n e E x c e p t i o n I n f o % 235c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 236c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 237c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% % 238c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 239c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 240c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% CloneExceptionInfo() clones the ExceptionInfo structure. 241c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 242c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% The format of the CloneExceptionInfo method is: 243c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 244c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% ExceptionInfo *CloneException(ExceptionInfo *exception) 245c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 246c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% A description of each parameter follows: 247c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 248c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% o exception: the exception info. 249c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy% 250c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy*/ 251c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristyMagickExport ExceptionInfo *CloneExceptionInfo(ExceptionInfo *exception) 252c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy{ 253c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy ExceptionInfo 254c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy *clone_exception; 255c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy 256c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy clone_exception=(ExceptionInfo *) AcquireMagickMemory(sizeof(*exception)); 257c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy if (clone_exception == (ExceptionInfo *) NULL) 258c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 259c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy GetExceptionInfo(clone_exception); 260c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy InheritException(clone_exception,exception); 2614592b2c7a40c37efd17aaa688be0d18fe953bd8fcristy clone_exception->relinquish=MagickTrue; 262c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy return(exception); 263c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy} 264c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy 265c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy/* 266c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t E r r o r H a n d l e r % 2713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 2743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultErrorHandler() displays an error reason. 2773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultErrorHandler method is: 2793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickError(const ExceptionType severity,const char *reason, 2813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 2823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 2843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 2863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 2883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 2893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 2913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 2923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 2933ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void DefaultErrorHandler(const ExceptionType magick_unused(severity), 2943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 2953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 2963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 2973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 298b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,"%s: %s",GetClientName(),reason); 2993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 300b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr," (%s)",description); 301b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,".\n"); 3023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 3033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t F a t a l E r r o r H a n d l e r % 3113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultFatalErrorHandler() displays an error reason and then terminates the 3173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 3183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultFatalErrorHandler method is: 3203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickFatalError(const ExceptionType severity,const char *reason, 3223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 3233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 3253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 3273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 328b200b6c973701dcc4e43539e1da620fc25aa2c29cristy% o reason: Specifies the reason to display before terminating the program. 3293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 3313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 333b200b6c973701dcc4e43539e1da620fc25aa2c29cristystatic void DefaultFatalErrorHandler(const ExceptionType severity, 3343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 3353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 3363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 3373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 338b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,"%s: %s",GetClientName(),reason); 3393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 340b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr," (%s)",description); 341b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,".\n"); 3423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 3433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickCoreTerminus(); 344b4d552cbf0187d092fc9f83fdca1ef6ce90206fbcristy exit((int) (severity-FatalErrorException)+1); 3453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy+ D e f a u l t W a r n i n g H a n d l e r % 3533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DefaultWarningHandler() displays a warning reason. 3593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DefaultWarningHandler method is: 3613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3623b743bb1b7243007b41c2d143bd529c884069efccristy% void DefaultWarningHandler(const ExceptionType severity, 3633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *reason,const char *description) 3643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 3663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3673b743bb1b7243007b41c2d143bd529c884069efccristy% o severity: Specifies the numeric warning category. 3683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 3703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 3713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 3733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 3753ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void DefaultWarningHandler(const ExceptionType magick_unused(severity), 3763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *reason,const char *description) 3773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 3783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason == (char *) NULL) 3793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 380b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,"%s: %s",GetClientName(),reason); 3813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (char *) NULL) 382b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr," (%s)",description); 383b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleFile(stderr,".\n"); 3843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) fflush(stderr); 3853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 3863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 3873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 3883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% D e s t r o y E x c e p t i o n I n f o % 3933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 3963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 3983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% DestroyExceptionInfo() deallocates memory associated with an exception. 3993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the DestroyExceptionInfo method is: 4013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) 4033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 4073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4093ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) 4103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 4123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relinquish; 4133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 4153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 41678883b2620bba1a3572967ae6e04bcd5f42339d6cristy if (exception->semaphore == (SemaphoreInfo *) NULL) 41778883b2620bba1a3572967ae6e04bcd5f42339d6cristy AcquireSemaphoreInfo(&exception->semaphore); 418f84a193d5f435588cd78d521fff3f1f852e227f8cristy LockSemaphoreInfo(exception->semaphore); 4193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 4203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->exceptions != (void *) NULL) 4213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions=(void *) DestroyLinkedList((LinkedListInfo *) 4223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions,DestroyExceptionElement); 4233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relinquish=exception->relinquish; 4243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (exception->relinquish != MagickFalse) 4253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->signature=(~MagickSignature); 426f84a193d5f435588cd78d521fff3f1f852e227f8cristy UnlockSemaphoreInfo(exception->semaphore); 4273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy DestroySemaphoreInfo(&exception->semaphore); 4283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (relinquish != MagickFalse) 4293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception=(ExceptionInfo *) RelinquishMagickMemory(exception); 4303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(exception); 4313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 4323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 4343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% G e t E x c e p t i o n I n f o % 4393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionInfo() initializes an exception to default values. 4453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetExceptionInfo method is: 4473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionInfo(ExceptionInfo *exception) 4493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 4533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4553ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void GetExceptionInfo(ExceptionInfo *exception) 4563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 4583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ResetMagickMemory(exception,0,sizeof(*exception)); 4593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->severity=UndefinedException; 4603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions=(void *) NewLinkedList(0); 46118b17443128598500357da7bff2f01683cf32890cristy exception->semaphore=AllocateSemaphoreInfo(); 4623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->signature=MagickSignature; 4633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 4643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 4653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 4663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% G e t E x c e p t i o n M e s s a g e % 4713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 4743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetExceptionMessage() returns the error message defined by the specified 4773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% error code. 4783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetExceptionMessage method is: 4803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% char *GetExceptionMessage(const int error) 4823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 4843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o error: the error code. 4863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 4873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 4883ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport char *GetExceptionMessage(const int error) 4893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 4903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 4913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception[MaxTextExtent]; 4923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 493b56416944f1a142ac6fc387f125cbd3bf00ccd65cristy *exception='\0'; 4943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(MAGICKCORE_HAVE_STRERROR_R) 4957d4a1d61307140a43a65a85587eb9ee09a00d1bfcristy#if !defined(MAGICKCORE_STRERROR_R_CHAR_P) 4963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) strerror_r(error,exception,sizeof(exception)); 4973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else 498866a02f04bdc706d86be55b1182f9ac4c48ce03bcristy (void) CopyMagickString(exception,strerror_r(error,exception, 499866a02f04bdc706d86be55b1182f9ac4c48ce03bcristy sizeof(exception)),sizeof(exception)); 500866a02f04bdc706d86be55b1182f9ac4c48ce03bcristy#endif 501866a02f04bdc706d86be55b1182f9ac4c48ce03bcristy#else 5023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) CopyMagickString(exception,strerror(error),sizeof(exception)); 5033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 5043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(ConstantString(exception)); 5053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 5063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 5083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 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 % 5133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 5163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% GetLocaleExceptionMessage() converts a enumerated exception severity and tag 5193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% to a message in the current locale. 5203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the GetLocaleExceptionMessage method is: 5223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *GetLocaleExceptionMessage(const ExceptionType severity, 5243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *tag) 5253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 5273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: the severity of the exception. 5293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o tag: the message tag. 5313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 5323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 5333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 5343ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic const char *ExceptionSeverityToTag(const ExceptionType severity) 5353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 5363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy switch (severity) 5373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 5383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitWarning: return("Resource/Limit/Warning/"); 5393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeWarning: return("Type/Warning/"); 5403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionWarning: return("Option/Warning/"); 5413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateWarning: return("Delegate/Warning/"); 5423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateWarning: return("Missing/Delegate/Warning/"); 5433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageWarning: return("Corrupt/Image/Warning/"); 5443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenWarning: return("File/Open/Warning/"); 5453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobWarning: return("Blob/Warning/"); 5463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamWarning: return("Stream/Warning/"); 5473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheWarning: return("Cache/Warning/"); 5483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderWarning: return("Coder/Warning/"); 549992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterWarning: return("Filter/Warning/"); 5503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleWarning: return("Module/Warning/"); 5513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawWarning: return("Draw/Warning/"); 5523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageWarning: return("Image/Warning/"); 5533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandWarning: return("Wand/Warning/"); 5543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerWarning: return("XServer/Warning/"); 5553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorWarning: return("Monitor/Warning/"); 5563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryWarning: return("Registry/Warning/"); 5573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureWarning: return("Configure/Warning/"); 5583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyWarning: return("Policy/Warning/"); 5593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitError: return("Resource/Limit/Error/"); 5603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeError: return("Type/Error/"); 5613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionError: return("Option/Error/"); 5623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateError: return("Delegate/Error/"); 5633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateError: return("Missing/Delegate/Error/"); 5643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageError: return("Corrupt/Image/Error/"); 5653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenError: return("File/Open/Error/"); 5663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobError: return("Blob/Error/"); 5673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamError: return("Stream/Error/"); 5683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheError: return("Cache/Error/"); 5693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderError: return("Coder/Error/"); 570992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterError: return("Filter/Error/"); 5713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleError: return("Module/Error/"); 5723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawError: return("Draw/Error/"); 5733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageError: return("Image/Error/"); 5743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandError: return("Wand/Error/"); 5753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerError: return("XServer/Error/"); 5763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorError: return("Monitor/Error/"); 5773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryError: return("Registry/Error/"); 5783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureError: return("Configure/Error/"); 5793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyError: return("Policy/Error/"); 5803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ResourceLimitFatalError: return("Resource/Limit/FatalError/"); 5813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case TypeFatalError: return("Type/FatalError/"); 5823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case OptionFatalError: return("Option/FatalError/"); 5833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DelegateFatalError: return("Delegate/FatalError/"); 5843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MissingDelegateFatalError: return("Missing/Delegate/FatalError/"); 5853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CorruptImageFatalError: return("Corrupt/Image/FatalError/"); 5863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case FileOpenFatalError: return("File/Open/FatalError/"); 5873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case BlobFatalError: return("Blob/FatalError/"); 5883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case StreamFatalError: return("Stream/FatalError/"); 5893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CacheFatalError: return("Cache/FatalError/"); 5903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case CoderFatalError: return("Coder/FatalError/"); 591992729daaa55bb5c0c49f54cc525f992e09ccae3cristy case FilterFatalError: return("Filter/FatalError/"); 5923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ModuleFatalError: return("Module/FatalError/"); 5933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case DrawFatalError: return("Draw/FatalError/"); 5943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ImageFatalError: return("Image/FatalError/"); 5953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case WandFatalError: return("Wand/FatalError/"); 5963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case XServerFatalError: return("XServer/FatalError/"); 5973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case MonitorFatalError: return("Monitor/FatalError/"); 5983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case RegistryFatalError: return("Registry/FatalError/"); 5993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case ConfigureFatalError: return("Configure/FatalError/"); 6003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy case PolicyFatalError: return("Policy/FatalError/"); 6013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy default: break; 6023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 6033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(""); 6043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 6053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6063ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport const char *GetLocaleExceptionMessage(const ExceptionType severity, 6073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *tag) 6083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 6093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 6103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy message[MaxTextExtent]; 6113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char 6133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *locale_message; 6143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(tag != (const char *) NULL); 616b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleString(message,MaxTextExtent,"Exception/%s%s", 6173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ExceptionSeverityToTag(severity),tag); 6183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy locale_message=GetLocaleMessage(message); 6193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (locale_message == (const char *) NULL) 6203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(tag); 6213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (locale_message == message) 6223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(tag); 6233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(locale_message); 6243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 6253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 6273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% I n h e r i t E x c e p t i o n % 6323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% InheritException() inherits an exception from a related exception. 6383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the InheritException method is: 6403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% InheritException(ExceptionInfo *exception,const ExceptionInfo *relative) 6423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 6443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 6463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o relative: the related exception info. 6483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 6503ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void InheritException(ExceptionInfo *exception, 6513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionInfo *relative) 6523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 6533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register const ExceptionInfo 6543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 6553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 6573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 6583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(relative != (ExceptionInfo *) NULL); 6593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(relative->signature == MagickSignature); 6603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (relative->exceptions == (void *) NULL) 6613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return; 66293670403847955b4bb6a820d62d1ac2c689fe84dcristy LockSemaphoreInfo(relative->semaphore); 6633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); 6643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 6653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relative->exceptions); 6663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy while (p != (const ExceptionInfo *) NULL) 6673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy { 6683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ThrowException(exception,p->severity,p->reason,p->description); 6693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) 6703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy relative->exceptions); 6713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 67293670403847955b4bb6a820d62d1ac2c689fe84dcristy UnlockSemaphoreInfo(relative->semaphore); 6733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 6743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 6753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 6763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k E r r o r % 6813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 6843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickError() calls the exception handler methods with an error reason. 6873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickError method is: 6893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickError(const ExceptionType error,const char *reason, 6913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 6923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 6943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: Specifies the numeric error category. 6963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 6973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 6983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 6993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 7013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7033ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickError(const ExceptionType error,const char *reason, 7043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 7053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (error_handler != (ErrorHandler) NULL) 7073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*error_handler)(error,reason,description); 7083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k F a t al E r r o r % 7163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickFatalError() calls the fatal exception handler methods with an error 7223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% reason. 7233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickError method is: 7253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickFatalError(const ExceptionType error,const char *reason, 7273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 7283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: Specifies the numeric error category. 7323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Specifies the reason to display before terminating the 7343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% program. 7353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Specifies any description to the reason. 7373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7393ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickFatalError(const ExceptionType error,const char *reason, 7403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 7413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (fatal_error_handler != (ErrorHandler) NULL) 7433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*fatal_error_handler)(error,reason,description); 7443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% M a g i c k W a r n i n g % 7523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickWarning() calls the warning handler methods with a warning reason. 7583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the MagickWarning method is: 7603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% void MagickWarning(const ExceptionType warning,const char *reason, 7623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 7633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o warning: the warning severity. 7673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: Define the reason for the warning. 7693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: Describe the warning. 7713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 7733ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport void MagickWarning(const ExceptionType warning,const char *reason, 7743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char *description) 7753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 7763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (warning_handler != (WarningHandler) NULL) 7773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (*warning_handler)(warning,reason,description); 7783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 7793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 7803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 7813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t E r r o r H a n d l e r % 7863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 7893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetErrorHandler() sets the exception handler to the specified method 7923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% and returns the previous exception handler. 7933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetErrorHandler method is: 7953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetErrorHandler(ErrorHandler handler) 7973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 7983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 7993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle errors. 8013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 8033ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport ErrorHandler SetErrorHandler(ErrorHandler handler) 8043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 8053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy ErrorHandler 8063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 8073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=error_handler; 8093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy error_handler=handler; 8103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 8113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 8123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 8143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t F a t a l E r r o r H a n d l e r % 8193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetFatalErrorHandler() sets the fatal exception handler to the specified 8253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% method and returns the previous fatal exception handler. 8263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetErrorHandler method is: 8283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetErrorHandler(ErrorHandler handler) 8303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 8323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle errors. 8343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 8363ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport FatalErrorHandler SetFatalErrorHandler(FatalErrorHandler handler) 8373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 8383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy FatalErrorHandler 8393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 8403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=fatal_error_handler; 8423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy fatal_error_handler=handler; 8433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 8443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 8453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 8473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% S e t W a r n i n g H a n d l e r % 8523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% SetWarningHandler() sets the warning handler to the specified method 8583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% and returns the previous warning handler. 8593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the SetWarningHandler method is: 8613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ErrorHandler SetWarningHandler(ErrorHandler handler) 8633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 8653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o handler: the method to handle warnings. 8673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 8693ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport WarningHandler SetWarningHandler(WarningHandler handler) 8703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 8713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy WarningHandler 8723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler; 8733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy previous_handler=warning_handler; 8753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy warning_handler=handler; 8763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(previous_handler); 8773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 8783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 8793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 8803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% T h r o w E x c e p t i o n % 8853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 8883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% ThrowException() throws an exception with the specified severity code, 8913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% reason, and optional description. 8923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ThrowException method is: 8943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickBooleanType ThrowException(ExceptionInfo *exception, 8963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const ExceptionType severity,const char *reason, 8973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const char *description) 8983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 8993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 9003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 9023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: the severity of the exception. 9043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o reason: the reason for the exception. 9063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o description: the exception description. 9083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 9103ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, 9113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionType severity,const char *reason,const char *description) 9123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 9133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy register ExceptionInfo 9143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy *p; 9153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 9173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 91893670403847955b4bb6a820d62d1ac2c689fe84dcristy LockSemaphoreInfo(exception->semaphore); 9193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p=(ExceptionInfo *) GetLastValueInLinkedList((LinkedListInfo *) 9203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy exception->exceptions); 9213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if ((p != (ExceptionInfo *) NULL) && (p->severity == severity) && 9223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (LocaleCompare(exception->reason,reason) == 0) && 9233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (LocaleCompare(exception->description,description) == 0)) 92493670403847955b4bb6a820d62d1ac2c689fe84dcristy { 92593670403847955b4bb6a820d62d1ac2c689fe84dcristy UnlockSemaphoreInfo(exception->semaphore); 92693670403847955b4bb6a820d62d1ac2c689fe84dcristy return(MagickTrue); 92793670403847955b4bb6a820d62d1ac2c689fe84dcristy } 92873bd4a51b419e914565bdf204bf1540dc4c8ee26cristy p=(ExceptionInfo *) AcquireMagickMemory(sizeof(*p)); 9293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (p == (ExceptionInfo *) NULL) 93093670403847955b4bb6a820d62d1ac2c689fe84dcristy { 93193670403847955b4bb6a820d62d1ac2c689fe84dcristy UnlockSemaphoreInfo(exception->semaphore); 93293670403847955b4bb6a820d62d1ac2c689fe84dcristy ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); 93393670403847955b4bb6a820d62d1ac2c689fe84dcristy } 9343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ResetMagickMemory(p,0,sizeof(*p)); 9353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->severity=severity; 9363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (reason != (const char *) NULL) 9373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->reason=ConstantString(reason); 9383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (description != (const char *) NULL) 9393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->description=ConstantString(description); 9403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy p->signature=MagickSignature; 9413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) AppendValueToLinkedList((LinkedListInfo *) exception->exceptions,p); 942992f537a471552415614fd4eddf5e30ec90cc2b6cristy if (p->severity >= exception->severity) 943992f537a471552415614fd4eddf5e30ec90cc2b6cristy { 944992f537a471552415614fd4eddf5e30ec90cc2b6cristy exception->severity=p->severity; 945992f537a471552415614fd4eddf5e30ec90cc2b6cristy exception->reason=p->reason; 946992f537a471552415614fd4eddf5e30ec90cc2b6cristy exception->description=p->description; 947992f537a471552415614fd4eddf5e30ec90cc2b6cristy } 94893670403847955b4bb6a820d62d1ac2c689fe84dcristy UnlockSemaphoreInfo(exception->semaphore); 9493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(MagickTrue); 9503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 9513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 9523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 9533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% T h r o w M a g i c k E x c e p t i o n % 9583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% % 9613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9635216f82250f6a3a9fe652a6534a46e0a69f5c6f7anthony% ThrowMagickException logs an exception as determined by the log 9645216f82250f6a3a9fe652a6534a46e0a69f5c6f7anthony% configuration file. If an error occurs, MagickFalse is returned 9655216f82250f6a3a9fe652a6534a46e0a69f5c6f7anthony% otherwise MagickTrue. 9663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% The format of the ThrowMagickException method is: 9683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% MagickBooleanType ThrowFileException(ExceptionInfo *exception, 970bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy% const char *module,const char *function,const size_t line, 9713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% const ExceptionType severity,const char *tag,const char *format,...) 9723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% A description of each parameter follows: 9743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o exception: the exception info. 9763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o filename: the source module filename. 9783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o function: the function name. 9803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o line: the line number of the source module. 9823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o severity: Specifies the numeric error category. 9843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o tag: the locale tag. 9863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% o format: the output format. 9883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy% 9893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/ 9903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 99193670403847955b4bb6a820d62d1ac2c689fe84dcristyMagickExport MagickBooleanType ThrowMagickExceptionList( 99293670403847955b4bb6a820d62d1ac2c689fe84dcristy ExceptionInfo *exception,const char *module,const char *function, 99393670403847955b4bb6a820d62d1ac2c689fe84dcristy const size_t line,const ExceptionType severity,const char *tag, 99493670403847955b4bb6a820d62d1ac2c689fe84dcristy const char *format,va_list operands) 9953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 9963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy char 9973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy message[MaxTextExtent], 9983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy path[MaxTextExtent], 9993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy reason[MaxTextExtent]; 10003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const char 100232cca407db0c7f1812b1809773513370b5813309cristy *locale, 100332cca407db0c7f1812b1809773513370b5813309cristy *type; 10043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy int 10063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n; 10073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 10093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status; 10103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy size_t 10123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy length; 10133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception != (ExceptionInfo *) NULL); 10153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy assert(exception->signature == MagickSignature); 10163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy locale=GetLocaleExceptionMessage(severity,tag); 10173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) CopyMagickString(reason,locale,MaxTextExtent); 10183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ConcatenateMagickString(reason," ",MaxTextExtent); 10193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy length=strlen(reason); 10203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#if defined(MAGICKCORE_HAVE_VSNPRINTF) 10213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n=vsnprintf(reason+length,MaxTextExtent-length,format,operands); 10223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else 10233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy n=vsprintf(reason+length,format,operands); 10243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif 10253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (n < 0) 10263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy reason[MaxTextExtent-1]='\0'; 10273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status=LogMagickEvent(ExceptionEvent,module,function,line,"%s",reason); 10283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy GetPathComponent(module,TailPath,path); 102932cca407db0c7f1812b1809773513370b5813309cristy type="undefined"; 103032cca407db0c7f1812b1809773513370b5813309cristy if ((severity >= WarningException) && (severity < ErrorException)) 103132cca407db0c7f1812b1809773513370b5813309cristy type="warning"; 103232cca407db0c7f1812b1809773513370b5813309cristy if ((severity >= ErrorException) && (severity < FatalErrorException)) 103332cca407db0c7f1812b1809773513370b5813309cristy type="error"; 103432cca407db0c7f1812b1809773513370b5813309cristy if (severity >= FatalErrorException) 103532cca407db0c7f1812b1809773513370b5813309cristy type="fatal"; 1036b51dff5c0d16a4c1b69ff683e786cb3b4c467694cristy (void) FormatLocaleString(message,MaxTextExtent,"%s @ %s/%s/%s/%.20g",reason, 1037e8c25f9b4c9fb72cad6db08eeda58c7c5784014ecristy type,path,function,(double) line); 10383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy (void) ThrowException(exception,severity,message,(char *) NULL); 10393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(status); 10403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 10413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10423ed852eea50f9d4cd633efb8c2b054b8e33c253cristyMagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, 1043bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy const char *module,const char *function,const size_t line, 10443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy const ExceptionType severity,const char *tag,const char *format,...) 10453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 10463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy MagickBooleanType 10473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status; 10483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_list 10503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy operands; 10513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 10523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_start(operands,format); 10533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy status=ThrowMagickExceptionList(exception,module,function,line,severity,tag, 10543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy format,operands); 10553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy va_end(operands); 10563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return(status); 10573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} 1058