< prev index next >

modules/javafx.graphics/src/main/native-iio/libjpeg7/jerror.c

Print this page


   1 /*
   2  * jerror.c
   3  *
   4  * Copyright (C) 1991-1998, Thomas G. Lane.

   5  * This file is part of the Independent JPEG Group's software.
   6  * For conditions of distribution and use, see the accompanying README file.
   7  *
   8  * This file contains simple error-reporting and trace-message routines.
   9  * These are suitable for Unix-like systems and others where writing to
  10  * stderr is the right thing to do.  Many applications will want to replace
  11  * some or all of these routines.
  12  *
  13  * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile,
  14  * you get a Windows-specific hack to display error messages in a dialog box.
  15  * It ain't much, but it beats dropping error messages into the bit bucket,
  16  * which is what happens to output to stderr under most Windows C compilers.
  17  *
  18  * These routines are used by both the compression and decompression code.
  19  */
  20 




  21 /* this is not a core library module, so it doesn't define JPEG_INTERNALS */
  22 #include "jinclude.h"
  23 #include "jpeglib.h"
  24 #include "jversion.h"
  25 #include "jerror.h"
  26 
  27 #ifdef USE_WINDOWS_MESSAGEBOX
  28 #include <windows.h>
  29 #endif
  30 
  31 #ifndef EXIT_FAILURE            /* define exit() codes if not provided */
  32 #define EXIT_FAILURE  1
  33 #endif
  34 
  35 
  36 /*
  37  * Create the message string table.
  38  * We do this from the master message list in jerror.h by re-reading
  39  * jerror.h with a suitable definition for macro JMESSAGE.
  40  * The message table is made an external symbol just in case any applications
  41  * want to refer to it directly.
  42  */
  43 
  44 #ifdef NEED_SHORT_EXTERNAL_NAMES
  45 #define jpeg_std_message_table  jMsgTable
  46 #endif
  47 
  48 #define JMESSAGE(code,string)   string ,
  49 
  50 const char * const jpeg_std_message_table[] = {
  51 #include "jerror.h"
  52   NULL
  53 };
  54 
  55 
  56 /*
  57  * Error exit handler: must not return to caller.
  58  *
  59  * Applications may override this if they want to get control back after
  60  * an error.  Typically one would longjmp somewhere instead of exiting.
  61  * The setjmp buffer can be made a private field within an expanded error
  62  * handler object.  Note that the info needed to generate an error message
  63  * is stored in the error object, so you can generate the message now or
  64  * later, at your convenience.
  65  * You should make sure that the JPEG object is cleaned up (with jpeg_abort
  66  * or jpeg_destroy) at some point.
  67  */
  68 
  69 METHODDEF(void)
  70 error_exit (j_common_ptr cinfo)
  71 {
  72   /* Always display the message */
  73   (*cinfo->err->output_message) (cinfo);
  74 
  75   /* Let the memory manager delete any temp files before we die */
  76   jpeg_destroy(cinfo);
  77 
  78   exit(EXIT_FAILURE);
  79 }
  80 
  81 
  82 /*
  83  * Actual output of an error or trace message.
  84  * Applications may override this method to send JPEG messages somewhere
  85  * other than stderr.
  86  *
  87  * On Windows, printing to stderr is generally completely useless,
  88  * so we provide optional code to produce an error-dialog popup.
  89  * Most Windows applications will still prefer to override this routine,


   1 /*
   2  * jerror.c
   3  *
   4  * Copyright (C) 1991-1998, Thomas G. Lane.
   5  * Modified 2012-2015 by Guido Vollbeding.
   6  * This file is part of the Independent JPEG Group's software.
   7  * For conditions of distribution and use, see the accompanying README file.
   8  *
   9  * This file contains simple error-reporting and trace-message routines.
  10  * These are suitable for Unix-like systems and others where writing to
  11  * stderr is the right thing to do.  Many applications will want to replace
  12  * some or all of these routines.
  13  *
  14  * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile,
  15  * you get a Windows-specific hack to display error messages in a dialog box.
  16  * It ain't much, but it beats dropping error messages into the bit bucket,
  17  * which is what happens to output to stderr under most Windows C compilers.
  18  *
  19  * These routines are used by both the compression and decompression code.
  20  */
  21 
  22 #ifdef USE_WINDOWS_MESSAGEBOX
  23 #include <windows.h>
  24 #endif
  25 
  26 /* this is not a core library module, so it doesn't define JPEG_INTERNALS */
  27 #include "jinclude.h"
  28 #include "jpeglib.h"
  29 #include "jversion.h"
  30 #include "jerror.h"
  31 




  32 #ifndef EXIT_FAILURE            /* define exit() codes if not provided */
  33 #define EXIT_FAILURE  1
  34 #endif
  35 
  36 
  37 /*
  38  * Create the message string table.
  39  * We do this from the master message list in jerror.h by re-reading
  40  * jerror.h with a suitable definition for macro JMESSAGE.
  41  * The message table is made an external symbol just in case any applications
  42  * want to refer to it directly.
  43  */
  44 
  45 #ifdef NEED_SHORT_EXTERNAL_NAMES
  46 #define jpeg_std_message_table  jMsgTable
  47 #endif
  48 
  49 #define JMESSAGE(code,string)   string ,
  50 
  51 const char * const jpeg_std_message_table[] = {
  52 #include "jerror.h"
  53   NULL
  54 };
  55 
  56 
  57 /*
  58  * Error exit handler: must not return to caller.
  59  *
  60  * Applications may override this if they want to get control back after
  61  * an error.  Typically one would longjmp somewhere instead of exiting.
  62  * The setjmp buffer can be made a private field within an expanded error
  63  * handler object.  Note that the info needed to generate an error message
  64  * is stored in the error object, so you can generate the message now or
  65  * later, at your convenience.
  66  * You should make sure that the JPEG object is cleaned up (with jpeg_abort
  67  * or jpeg_destroy) at some point.
  68  */
  69 
  70 METHODDEF(noreturn_t)
  71 error_exit (j_common_ptr cinfo)
  72 {
  73   /* Always display the message */
  74   (*cinfo->err->output_message) (cinfo);
  75 
  76   /* Let the memory manager delete any temp files before we die */
  77   jpeg_destroy(cinfo);
  78 
  79   exit(EXIT_FAILURE);
  80 }
  81 
  82 
  83 /*
  84  * Actual output of an error or trace message.
  85  * Applications may override this method to send JPEG messages somewhere
  86  * other than stderr.
  87  *
  88  * On Windows, printing to stderr is generally completely useless,
  89  * so we provide optional code to produce an error-dialog popup.
  90  * Most Windows applications will still prefer to override this routine,


< prev index next >