0N/A * reserved comment block 0N/A * DO NOT REMOVE OR ALTER! 0N/A * Copyright (C) 1991-1998, Thomas G. Lane. 0N/A * This file is part of the Independent JPEG Group's software. 0N/A * For conditions of distribution and use, see the accompanying README file. 0N/A * This file contains simple error-reporting and trace-message routines. 0N/A * These are suitable for Unix-like systems and others where writing to 0N/A * stderr is the right thing to do. Many applications will want to replace 0N/A * some or all of these routines. 0N/A * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile, 0N/A * you get a Windows-specific hack to display error messages in a dialog box. 0N/A * It ain't much, but it beats dropping error messages into the bit bucket, 0N/A * which is what happens to output to stderr under most Windows C compilers. 0N/A * These routines are used by both the compression and decompression code. 0N/A/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ 0N/A * Create the message string table. 0N/A * We do this from the master message list in jerror.h by re-reading 0N/A * jerror.h with a suitable definition for macro JMESSAGE. 0N/A * The message table is made an external symbol just in case any applications 0N/A * want to refer to it directly. 0N/A * Error exit handler: must not return to caller. 0N/A * Applications may override this if they want to get control back after 0N/A * an error. Typically one would longjmp somewhere instead of exiting. 0N/A * The setjmp buffer can be made a private field within an expanded error 0N/A * handler object. Note that the info needed to generate an error message 0N/A * is stored in the error object, so you can generate the message now or 0N/A * later, at your convenience. 0N/A * You should make sure that the JPEG object is cleaned up (with jpeg_abort 0N/A * or jpeg_destroy) at some point. 0N/A /* Always display the message */ 0N/A /* Let the memory manager delete any temp files before we die */ 0N/A * This should never happen since the Java library replaces the 0N/A * error_exit pointer in the error handler structs it uses. 0N/A * exit(EXIT_FAILURE); 0N/A * Actual output of an error or trace message. 0N/A * Applications may override this method to send JPEG messages somewhere 0N/A * other than stderr. 0N/A * On Windows, printing to stderr is generally completely useless, 0N/A * so we provide optional code to produce an error-dialog popup. 0N/A * Most Windows applications will still prefer to override this routine, 0N/A * but if they don't, it'll do something at least marginally useful. 0N/A * NOTE: to use the library in an environment that doesn't support the 0N/A * C stdio library, you may have to delete the call to fprintf() entirely, 0N/A * not just not use this routine. 0N/A /* Create the message */ 0N/A /* Display it in a message dialog box */ 0N/A /* Send it to stderr, adding a newline */ 0N/A * Decide whether to emit a trace or warning message. 0N/A * msg_level is one of: 0N/A * -1: recoverable corrupt-data warning, may want to abort. 0N/A * 0: important advisory messages (always display to user). 0N/A * 1: first level of tracing detail. 0N/A * 2,3,...: successively more detailed tracing messages. 0N/A * An application might override this method if it wanted to abort on warnings 0N/A * or change the policy about which messages to display. 0N/A /* It's a warning message. Since corrupt files may generate many warnings, 0N/A * the policy implemented here is to show only the first warning, 0N/A * unless trace_level >= 3. 0N/A /* Always count warnings in num_warnings. */ 0N/A /* It's a trace message. Show it if trace_level >= msg_level. */ 0N/A * Format a message string for the most recent JPEG error or message. 0N/A * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX 0N/A * characters. Note that no '\n' character is added to the string. 0N/A * Few applications should need to override this method. 0N/A/* Had to kill this function altogether 0N/A to avoid linking to VM when building the splash screen with static libjpeg */ 0N/A /* Look up message string in proper table */ 0N/A /* Defend against bogus message number */ 0N/A /* Check for string parameter, as indicated by %s in the message text */ 0N/A /* Format the message into the passed buffer */ 0N/A /* Buffer size is JMSG_LENGTH_MAX, quietly truncate on overflow */ 0N/A /* Buffer size is JMSG_LENGTH_MAX, quietly truncate on overflow */ 0N/A#
else /* SPLASHSCREEN */ 0N/A#
endif /* SPLASHSCREEN */ 0N/A * Reset error state variables at start of a new image. 0N/A * processing to default state, without losing any application-specific 0N/A * method pointers. An application might possibly want to override 0N/A * this method if it has additional error processing state. 0N/A /* trace_level is not reset since it is an application-supplied parameter */ 0N/A * Fill in the standard error-handling methods in a jpeg_error_mgr object. 0N/A * struct jpeg_compress_struct cinfo; 0N/A * struct jpeg_error_mgr err; 0N/A * cinfo.err = jpeg_std_error(&err); 0N/A * after which the application may override some of the methods. 0N/A /* Initialize message table pointers */