| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | #include "magick/studio.h" |
|---|
| 44 | #include "magick/client.h" |
|---|
| 45 | #include "magick/exception.h" |
|---|
| 46 | #include "magick/exception-private.h" |
|---|
| 47 | #include "magick/hashmap.h" |
|---|
| 48 | #include "magick/locale_.h" |
|---|
| 49 | #include "magick/log.h" |
|---|
| 50 | #include "magick/magick.h" |
|---|
| 51 | #include "magick/memory_.h" |
|---|
| 52 | #include "magick/string_.h" |
|---|
| 53 | #include "magick/utility.h" |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 59 | extern "C" { |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | static void |
|---|
| 63 | DefaultErrorHandler(const ExceptionType,const char *,const char *), |
|---|
| 64 | DefaultFatalErrorHandler(const ExceptionType,const char *,const char *), |
|---|
| 65 | DefaultWarningHandler(const ExceptionType,const char *,const char *); |
|---|
| 66 | |
|---|
| 67 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 68 | } |
|---|
| 69 | #endif |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | static ErrorHandler |
|---|
| 75 | error_handler = DefaultErrorHandler; |
|---|
| 76 | |
|---|
| 77 | static FatalErrorHandler |
|---|
| 78 | fatal_error_handler = DefaultFatalErrorHandler; |
|---|
| 79 | |
|---|
| 80 | static WarningHandler |
|---|
| 81 | warning_handler = DefaultWarningHandler; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | MagickExport ExceptionInfo *AcquireExceptionInfo(void) |
|---|
| 102 | { |
|---|
| 103 | ExceptionInfo |
|---|
| 104 | *exception; |
|---|
| 105 | |
|---|
| 106 | exception=(ExceptionInfo *) AcquireMagickMemory(sizeof(*exception)); |
|---|
| 107 | if (exception == (ExceptionInfo *) NULL) |
|---|
| 108 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
|---|
| 109 | GetExceptionInfo(exception); |
|---|
| 110 | exception->relinquish=MagickTrue; |
|---|
| 111 | return(exception); |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | static void *DestroyExceptionElement(void *exception) |
|---|
| 139 | { |
|---|
| 140 | register ExceptionInfo |
|---|
| 141 | *p; |
|---|
| 142 | |
|---|
| 143 | p=(ExceptionInfo *) exception; |
|---|
| 144 | if (p->reason != (char *) NULL) |
|---|
| 145 | p->reason=DestroyString(p->reason); |
|---|
| 146 | if (p->description != (char *) NULL) |
|---|
| 147 | p->description=DestroyString(p->description); |
|---|
| 148 | p=(ExceptionInfo *) RelinquishMagickMemory(p); |
|---|
| 149 | return((void *) NULL); |
|---|
| 150 | } |
|---|
| 151 | |
|---|
| 152 | MagickExport void ClearMagickException(ExceptionInfo *exception) |
|---|
| 153 | { |
|---|
| 154 | register ExceptionInfo |
|---|
| 155 | *p; |
|---|
| 156 | |
|---|
| 157 | assert(exception != (ExceptionInfo *) NULL); |
|---|
| 158 | assert(exception->signature == MagickSignature); |
|---|
| 159 | AcquireSemaphoreInfo(&exception->semaphore); |
|---|
| 160 | p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) |
|---|
| 161 | exception->exceptions); |
|---|
| 162 | while (p != (ExceptionInfo *) NULL) |
|---|
| 163 | { |
|---|
| 164 | (void) DestroyExceptionElement(p); |
|---|
| 165 | p=(ExceptionInfo *) RemoveLastElementFromLinkedList((LinkedListInfo *) |
|---|
| 166 | exception->exceptions); |
|---|
| 167 | } |
|---|
| 168 | exception->severity=UndefinedException; |
|---|
| 169 | exception->reason=(char *) NULL; |
|---|
| 170 | exception->description=(char *) NULL; |
|---|
| 171 | RelinquishSemaphoreInfo(exception->semaphore); |
|---|
| 172 | errno=0; |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | MagickExport void CatchException(ExceptionInfo *exception) |
|---|
| 199 | { |
|---|
| 200 | register const ExceptionInfo |
|---|
| 201 | *p; |
|---|
| 202 | |
|---|
| 203 | assert(exception != (ExceptionInfo *) NULL); |
|---|
| 204 | assert(exception->signature == MagickSignature); |
|---|
| 205 | AcquireSemaphoreInfo(&exception->semaphore); |
|---|
| 206 | ResetLinkedListIterator((LinkedListInfo *) exception->exceptions); |
|---|
| 207 | p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) |
|---|
| 208 | exception->exceptions); |
|---|
| 209 | while (p != (const ExceptionInfo *) NULL) |
|---|
| 210 | { |
|---|
| 211 | if ((p->severity >= WarningException) && (p->severity < ErrorException)) |
|---|
| 212 | MagickWarning(p->severity,p->reason,p->description); |
|---|
| 213 | if ((p->severity >= ErrorException) && (p->severity < FatalErrorException)) |
|---|
| 214 | MagickError(p->severity,p->reason,p->description); |
|---|
| 215 | if (exception->severity >= FatalErrorException) |
|---|
| 216 | MagickFatalError(p->severity,p->reason,p->description); |
|---|
| 217 | p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) |
|---|
| 218 | exception->exceptions); |
|---|
| 219 | } |
|---|
| 220 | RelinquishSemaphoreInfo(exception->semaphore); |
|---|
| 221 | ClearMagickException(exception); |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | |
|---|
| 251 | |
|---|
| 252 | static void DefaultErrorHandler(const ExceptionType magick_unused(severity), |
|---|
| 253 | const char *reason,const char *description) |
|---|
| 254 | { |
|---|
| 255 | if (reason == (char *) NULL) |
|---|
| 256 | return; |
|---|
| 257 | (void) fprintf(stderr,"%s: %s",GetClientName(),reason); |
|---|
| 258 | if (description != (char *) NULL) |
|---|
| 259 | (void) fprintf(stderr," (%s)",description); |
|---|
| 260 | (void) fprintf(stderr,".\n"); |
|---|
| 261 | (void) fflush(stderr); |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | |
|---|
| 278 | |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | static void DefaultFatalErrorHandler(const ExceptionType magick_unused(severity), |
|---|
| 294 | const char *reason,const char *description) |
|---|
| 295 | { |
|---|
| 296 | if (reason == (char *) NULL) |
|---|
| 297 | return; |
|---|
| 298 | (void) fprintf(stderr,"%s: %s",GetClientName(),reason); |
|---|
| 299 | if (description != (char *) NULL) |
|---|
| 300 | (void) fprintf(stderr," (%s)",description); |
|---|
| 301 | (void) fprintf(stderr,".\n"); |
|---|
| 302 | (void) fflush(stderr); |
|---|
| 303 | MagickCoreTerminus(); |
|---|
| 304 | exit(1); |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | static void DefaultWarningHandler(const ExceptionType magick_unused(severity), |
|---|
| 336 | const char *reason,const char *description) |
|---|
| 337 | { |
|---|
| 338 | if (reason == (char *) NULL) |
|---|
| 339 | return; |
|---|
| 340 | (void) fprintf(stderr,"%s: %s",GetClientName(),reason); |
|---|
| 341 | if (description != (char *) NULL) |
|---|
| 342 | (void) fprintf(stderr," (%s)",description); |
|---|
| 343 | (void) fprintf(stderr,".\n"); |
|---|
| 344 | (void) fflush(stderr); |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | |
|---|
| 355 | |
|---|
| 356 | |
|---|
| 357 | |
|---|
| 358 | |
|---|
| 359 | |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | MagickExport ExceptionInfo *DestroyExceptionInfo(ExceptionInfo *exception) |
|---|
| 370 | { |
|---|
| 371 | MagickBooleanType |
|---|
| 372 | relinquish; |
|---|
| 373 | |
|---|
| 374 | assert(exception != (ExceptionInfo *) NULL); |
|---|
| 375 | assert(exception->signature == MagickSignature); |
|---|
| 376 | AcquireSemaphoreInfo(&exception->semaphore); |
|---|
| 377 | exception->severity=UndefinedException; |
|---|
| 378 | if (exception->exceptions != (void *) NULL) |
|---|
| 379 | exception->exceptions=(void *) DestroyLinkedList((LinkedListInfo *) |
|---|
| 380 | exception->exceptions,DestroyExceptionElement); |
|---|
| 381 | relinquish=exception->relinquish; |
|---|
| 382 | if (exception->relinquish != MagickFalse) |
|---|
| 383 | exception->signature=(~MagickSignature); |
|---|
| 384 | RelinquishSemaphoreInfo(exception->semaphore); |
|---|
| 385 | DestroySemaphoreInfo(&exception->semaphore); |
|---|
| 386 | if (relinquish != MagickFalse) |
|---|
| 387 | exception=(ExceptionInfo *) RelinquishMagickMemory(exception); |
|---|
| 388 | return(exception); |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | |
|---|
| 400 | |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | |
|---|
| 412 | |
|---|
| 413 | MagickExport void GetExceptionInfo(ExceptionInfo *exception) |
|---|
| 414 | { |
|---|
| 415 | assert(exception != (ExceptionInfo *) NULL); |
|---|
| 416 | (void) ResetMagickMemory(exception,0,sizeof(*exception)); |
|---|
| 417 | exception->severity=UndefinedException; |
|---|
| 418 | exception->exceptions=(void *) NewLinkedList(0); |
|---|
| 419 | exception->signature=MagickSignature; |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | MagickExport char *GetExceptionMessage(const int error_code) |
|---|
| 446 | { |
|---|
| 447 | return(ConstantString(strerror(error_code))); |
|---|
| 448 | } |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | |
|---|
| 462 | |
|---|
| 463 | |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | |
|---|
| 467 | |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | |
|---|
| 471 | |
|---|
| 472 | |
|---|
| 473 | |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | |
|---|
| 477 | static const char *ExceptionSeverityToTag(const ExceptionType severity) |
|---|
| 478 | { |
|---|
| 479 | switch (severity) |
|---|
| 480 | { |
|---|
| 481 | case ResourceLimitWarning: return("Resource/Limit/Warning/"); |
|---|
| 482 | case TypeWarning: return("Type/Warning/"); |
|---|
| 483 | case OptionWarning: return("Option/Warning/"); |
|---|
| 484 | case DelegateWarning: return("Delegate/Warning/"); |
|---|
| 485 | case MissingDelegateWarning: return("Missing/Delegate/Warning/"); |
|---|
| 486 | case CorruptImageWarning: return("Corrupt/Image/Warning/"); |
|---|
| 487 | case FileOpenWarning: return("File/Open/Warning/"); |
|---|
| 488 | case BlobWarning: return("Blob/Warning/"); |
|---|
| 489 | case StreamWarning: return("Stream/Warning/"); |
|---|
| 490 | case CacheWarning: return("Cache/Warning/"); |
|---|
| 491 | case CoderWarning: return("Coder/Warning/"); |
|---|
| 492 | case ModuleWarning: return("Module/Warning/"); |
|---|
| 493 | case DrawWarning: return("Draw/Warning/"); |
|---|
| 494 | case ImageWarning: return("Image/Warning/"); |
|---|
| 495 | case WandWarning: return("Wand/Warning/"); |
|---|
| 496 | case XServerWarning: return("XServer/Warning/"); |
|---|
| 497 | case MonitorWarning: return("Monitor/Warning/"); |
|---|
| 498 | case RegistryWarning: return("Registry/Warning/"); |
|---|
| 499 | case ConfigureWarning: return("Configure/Warning/"); |
|---|
| 500 | case ResourceLimitError: return("Resource/Limit/Error/"); |
|---|
| 501 | case TypeError: return("Type/Error/"); |
|---|
| 502 | case OptionError: return("Option/Error/"); |
|---|
| 503 | case DelegateError: return("Delegate/Error/"); |
|---|
| 504 | case MissingDelegateError: return("Missing/Delegate/Error/"); |
|---|
| 505 | case CorruptImageError: return("Corrupt/Image/Error/"); |
|---|
| 506 | case FileOpenError: return("File/Open/Error/"); |
|---|
| 507 | case BlobError: return("Blob/Error/"); |
|---|
| 508 | case StreamError: return("Stream/Error/"); |
|---|
| 509 | case CacheError: return("Cache/Error/"); |
|---|
| 510 | case CoderError: return("Coder/Error/"); |
|---|
| 511 | case ModuleError: return("Module/Error/"); |
|---|
| 512 | case DrawError: return("Draw/Error/"); |
|---|
| 513 | case ImageError: return("Image/Error/"); |
|---|
| 514 | case WandError: return("Wand/Error/"); |
|---|
| 515 | case XServerError: return("XServer/Error/"); |
|---|
| 516 | case MonitorError: return("Monitor/Error/"); |
|---|
| 517 | case RegistryError: return("Registry/Error/"); |
|---|
| 518 | case ConfigureError: return("Configure/Error/"); |
|---|
| 519 | case ResourceLimitFatalError: return("Resource/Limit/FatalError/"); |
|---|
| 520 | case TypeFatalError: return("Type/FatalError/"); |
|---|
| 521 | case OptionFatalError: return("Option/FatalError/"); |
|---|
| 522 | case DelegateFatalError: return("Delegate/FatalError/"); |
|---|
| 523 | case MissingDelegateFatalError: return("Missing/Delegate/FatalError/"); |
|---|
| 524 | case CorruptImageFatalError: return("Corrupt/Image/FatalError/"); |
|---|
| 525 | case FileOpenFatalError: return("File/Open/FatalError/"); |
|---|
| 526 | case BlobFatalError: return("Blob/FatalError/"); |
|---|
| 527 | case StreamFatalError: return("Stream/FatalError/"); |
|---|
| 528 | case CacheFatalError: return("Cache/FatalError/"); |
|---|
| 529 | case CoderFatalError: return("Coder/FatalError/"); |
|---|
| 530 | case ModuleFatalError: return("Module/FatalError/"); |
|---|
| 531 | case DrawFatalError: return("Draw/FatalError/"); |
|---|
| 532 | case ImageFatalError: return("Image/FatalError/"); |
|---|
| 533 | case WandFatalError: return("Wand/FatalError/"); |
|---|
| 534 | case XServerFatalError: return("XServer/FatalError/"); |
|---|
| 535 | case MonitorFatalError: return("Monitor/FatalError/"); |
|---|
| 536 | case RegistryFatalError: return("Registry/FatalError/"); |
|---|
| 537 | case ConfigureFatalError: return("Configure/FatalError/"); |
|---|
| 538 | default: break; |
|---|
| 539 | } |
|---|
| 540 | return(""); |
|---|
| 541 | } |
|---|
| 542 | |
|---|
| 543 | MagickExport const char *GetLocaleExceptionMessage(const ExceptionType severity, |
|---|
| 544 | const char *tag) |
|---|
| 545 | { |
|---|
| 546 | char |
|---|
| 547 | message[MaxTextExtent]; |
|---|
| 548 | |
|---|
| 549 | const char |
|---|
| 550 | *locale_message; |
|---|
| 551 | |
|---|
| 552 | assert(tag != (const char *) NULL); |
|---|
| 553 | (void) FormatMagickString(message,MaxTextExtent,"Exception/%s%s", |
|---|
| 554 | ExceptionSeverityToTag(severity),tag); |
|---|
| 555 | locale_message=GetLocaleMessage(message); |
|---|
| 556 | if (locale_message == (const char *) NULL) |
|---|
| 557 | return(tag); |
|---|
| 558 | if (locale_message == message) |
|---|
| 559 | return(tag); |
|---|
| 560 | return(locale_message); |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | |
|---|
| 568 | |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | |
|---|
| 572 | |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | |
|---|
| 581 | |
|---|
| 582 | |
|---|
| 583 | |
|---|
| 584 | |
|---|
| 585 | |
|---|
| 586 | |
|---|
| 587 | MagickExport void InheritException(ExceptionInfo *exception, |
|---|
| 588 | const ExceptionInfo *relative) |
|---|
| 589 | { |
|---|
| 590 | register const ExceptionInfo |
|---|
| 591 | *p; |
|---|
| 592 | |
|---|
| 593 | assert(exception != (ExceptionInfo *) NULL); |
|---|
| 594 | assert(exception->signature == MagickSignature); |
|---|
| 595 | assert(relative != (ExceptionInfo *) NULL); |
|---|
| 596 | assert(relative->signature == MagickSignature); |
|---|
| 597 | AcquireSemaphoreInfo(&exception->semaphore); |
|---|
| 598 | ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); |
|---|
| 599 | p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) |
|---|
| 600 | relative->exceptions); |
|---|
| 601 | while (p != (const ExceptionInfo *) NULL) |
|---|
| 602 | { |
|---|
| 603 | (void) ThrowException(exception,p->severity,p->reason,p->description); |
|---|
| 604 | p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) |
|---|
| 605 | relative->exceptions); |
|---|
| 606 | } |
|---|
| 607 | RelinquishSemaphoreInfo(exception->semaphore); |
|---|
| 608 | } |
|---|
| 609 | |
|---|
| 610 | |
|---|
| 611 | |
|---|
| 612 | |
|---|
| 613 | |
|---|
| 614 | |
|---|
| 615 | |
|---|
| 616 | |
|---|
| 617 | |
|---|
| 618 | |
|---|
| 619 | |
|---|
| 620 | |
|---|
| 621 | |
|---|
| 622 | |
|---|
| 623 | |
|---|
| 624 | |
|---|
| 625 | |
|---|
| 626 | |
|---|
| 627 | |
|---|
| 628 | |
|---|
| 629 | |
|---|
| 630 | |
|---|
| 631 | |
|---|
| 632 | |
|---|
| 633 | |
|---|
| 634 | |
|---|
| 635 | |
|---|
| 636 | |
|---|
| 637 | |
|---|
| 638 | MagickExport void MagickError(const ExceptionType error,const char *reason, |
|---|
| 639 | const char *description) |
|---|
| 640 | { |
|---|
| 641 | if (error_handler != (ErrorHandler) NULL) |
|---|
| 642 | (*error_handler)(error,reason,description); |
|---|
| 643 | } |
|---|
| 644 | |
|---|
| 645 | |
|---|
| 646 | |
|---|
| 647 | |
|---|
| 648 | |
|---|
| 649 | |
|---|
| 650 | |
|---|
| 651 | |
|---|
| 652 | |
|---|
| 653 | |
|---|
| 654 | |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | |
|---|
| 658 | |
|---|
| 659 | |
|---|
| 660 | |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | |
|---|
| 664 | |
|---|
| 665 | |
|---|
| 666 | |
|---|
| 667 | |
|---|
| 668 | |
|---|
| 669 | |
|---|
| 670 | |
|---|
| 671 | |
|---|
| 672 | |
|---|
| 673 | |
|---|
| 674 | MagickExport void MagickFatalError(const ExceptionType error,const char *reason, |
|---|
| 675 | const char *description) |
|---|
| 676 | { |
|---|
| 677 | if (fatal_error_handler != (ErrorHandler) NULL) |
|---|
| 678 | (*fatal_error_handler)(error,reason,description); |
|---|
| 679 | } |
|---|
| 680 | |
|---|
| 681 | |
|---|
| 682 | |
|---|
| 683 | |
|---|
| 684 | |
|---|
| 685 | |
|---|
| 686 | |
|---|
| 687 | |
|---|
| 688 | |
|---|
| 689 | |
|---|
| 690 | |
|---|
| 691 | |
|---|
| 692 | |
|---|
| 693 | |
|---|
| 694 | |
|---|
| 695 | |
|---|
| 696 | |
|---|
| 697 | |
|---|
| 698 | |
|---|
| 699 | |
|---|
| 700 | |
|---|
| 701 | |
|---|
| 702 | |
|---|
| 703 | |
|---|
| 704 | |
|---|
| 705 | |
|---|
| 706 | |
|---|
| 707 | |
|---|
| 708 | MagickExport void MagickWarning(const ExceptionType warning,const char *reason, |
|---|
| 709 | const char *description) |
|---|
| 710 | { |
|---|
| 711 | if (warning_handler != (WarningHandler) NULL) |
|---|
| 712 | (*warning_handler)(warning,reason,description); |
|---|
| 713 | } |
|---|
| 714 | |
|---|
| 715 | |
|---|
| 716 | |
|---|
| 717 | |
|---|
| 718 | |
|---|
| 719 | |
|---|
| 720 | |
|---|
| 721 | |
|---|
| 722 | |
|---|
| 723 | |
|---|
| 724 | |
|---|
| 725 | |
|---|
| 726 | |
|---|
| 727 | |
|---|
| 728 | |
|---|
| 729 | |
|---|
| 730 | |
|---|
| 731 | |
|---|
| 732 | |
|---|
| 733 | |
|---|
| 734 | |
|---|
| 735 | |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | MagickExport ErrorHandler SetErrorHandler(ErrorHandler handler) |
|---|
| 739 | { |
|---|
| 740 | ErrorHandler |
|---|
| 741 | previous_handler; |
|---|
| 742 | |
|---|
| 743 | previous_handler=error_handler; |
|---|
| 744 | error_handler=handler; |
|---|
| 745 | return(previous_handler); |
|---|
| 746 | } |
|---|
| 747 | |
|---|
| 748 | |
|---|
| 749 | |
|---|
| 750 | |
|---|
| 751 | |
|---|
| 752 | |
|---|
| 753 | |
|---|
| 754 | |
|---|
| 755 | |
|---|
| 756 | |
|---|
| 757 | |
|---|
| 758 | |
|---|
| 759 | |
|---|
| 760 | |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | |
|---|
| 764 | |
|---|
| 765 | |
|---|
| 766 | |
|---|
| 767 | |
|---|
| 768 | |
|---|
| 769 | |
|---|
| 770 | |
|---|
| 771 | MagickExport FatalErrorHandler SetFatalErrorHandler(FatalErrorHandler handler) |
|---|
| 772 | { |
|---|
| 773 | FatalErrorHandler |
|---|
| 774 | previous_handler; |
|---|
| 775 | |
|---|
| 776 | previous_handler=fatal_error_handler; |
|---|
| 777 | fatal_error_handler=handler; |
|---|
| 778 | return(previous_handler); |
|---|
| 779 | } |
|---|
| 780 | |
|---|
| 781 | |
|---|
| 782 | |
|---|
| 783 | |
|---|
| 784 | |
|---|
| 785 | |
|---|
| 786 | |
|---|
| 787 | |
|---|
| 788 | |
|---|
| 789 | |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | |
|---|
| 793 | |
|---|
| 794 | |
|---|
| 795 | |
|---|
| 796 | |
|---|
| 797 | |
|---|
| 798 | |
|---|
| 799 | |
|---|
| 800 | |
|---|
| 801 | |
|---|
| 802 | |
|---|
| 803 | |
|---|
| 804 | MagickExport WarningHandler SetWarningHandler(WarningHandler handler) |
|---|
| 805 | { |
|---|
| 806 | WarningHandler |
|---|
| 807 | previous_handler; |
|---|
| 808 | |
|---|
| 809 | previous_handler=warning_handler; |
|---|
| 810 | warning_handler=handler; |
|---|
| 811 | return(previous_handler); |
|---|
| 812 | } |
|---|
| 813 | |
|---|
| 814 | |
|---|
| 815 | |
|---|
| 816 | |
|---|
| 817 | |
|---|
| 818 | |
|---|
| 819 | |
|---|
| 820 | |
|---|
| 821 | |
|---|