| Index: jmemsys.h
|
| diff --git a/jmemsys.h b/jmemsys.h
|
| index b190945963b0f0a34c2cc2b9ee5693ad1bb3c7f5..f7dfe87a833c15b5a91ff528bcdaef4c08f17ff9 100644
|
| --- a/jmemsys.h
|
| +++ b/jmemsys.h
|
| @@ -1,9 +1,12 @@
|
| /*
|
| * jmemsys.h
|
| *
|
| + * This file was part of the Independent JPEG Group's software:
|
| * Copyright (C) 1992-1997, Thomas G. Lane.
|
| - * This file is part of the Independent JPEG Group's software.
|
| - * For conditions of distribution and use, see the accompanying README file.
|
| + * It was modified by The libjpeg-turbo Project to include only code and
|
| + * information relevant to libjpeg-turbo.
|
| + * For conditions of distribution and use, see the accompanying README.ijg
|
| + * file.
|
| *
|
| * This include file defines the interface between the system-independent
|
| * and system-dependent portions of the JPEG memory manager. No other
|
| @@ -14,25 +17,10 @@
|
| * in the IJG distribution. You may need to modify it if you write a
|
| * custom memory manager. If system-dependent changes are needed in
|
| * this file, the best method is to #ifdef them based on a configuration
|
| - * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR
|
| - * and USE_MAC_MEMMGR.
|
| + * symbol supplied in jconfig.h.
|
| */
|
|
|
|
|
| -/* Short forms of external names for systems with brain-damaged linkers. */
|
| -
|
| -#ifdef NEED_SHORT_EXTERNAL_NAMES
|
| -#define jpeg_get_small jGetSmall
|
| -#define jpeg_free_small jFreeSmall
|
| -#define jpeg_get_large jGetLarge
|
| -#define jpeg_free_large jFreeLarge
|
| -#define jpeg_mem_available jMemAvail
|
| -#define jpeg_open_backing_store jOpenBackStore
|
| -#define jpeg_mem_init jMemInit
|
| -#define jpeg_mem_term jMemTerm
|
| -#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
| -
|
| -
|
| /*
|
| * These two functions are used to allocate and release small chunks of
|
| * memory. (Typically the total amount requested through jpeg_get_small is
|
| @@ -41,40 +29,36 @@
|
| * and free; in particular, jpeg_get_small must return NULL on failure.
|
| * On most systems, these ARE malloc and free. jpeg_free_small is passed the
|
| * size of the object being freed, just in case it's needed.
|
| - * On an 80x86 machine using small-data memory model, these manage near heap.
|
| */
|
|
|
| -EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject));
|
| -EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object,
|
| - size_t sizeofobject));
|
| +EXTERN(void *) jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject);
|
| +EXTERN(void) jpeg_free_small (j_common_ptr cinfo, void *object,
|
| + size_t sizeofobject);
|
|
|
| /*
|
| * These two functions are used to allocate and release large chunks of
|
| * memory (up to the total free space designated by jpeg_mem_available).
|
| - * The interface is the same as above, except that on an 80x86 machine,
|
| - * far pointers are used. On most other machines these are identical to
|
| - * the jpeg_get/free_small routines; but we keep them separate anyway,
|
| - * in case a different allocation strategy is desirable for large chunks.
|
| + * These are identical to the jpeg_get/free_small routines; but we keep them
|
| + * separate anyway, in case a different allocation strategy is desirable for
|
| + * large chunks.
|
| */
|
|
|
| -EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo,
|
| - size_t sizeofobject));
|
| -EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
|
| - size_t sizeofobject));
|
| +EXTERN(void *) jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject);
|
| +EXTERN(void) jpeg_free_large (j_common_ptr cinfo, void *object,
|
| + size_t sizeofobject);
|
|
|
| /*
|
| * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may
|
| * be requested in a single call to jpeg_get_large (and jpeg_get_small for that
|
| - * matter, but that case should never come into play). This macro is needed
|
| + * matter, but that case should never come into play). This macro was needed
|
| * to model the 64Kb-segment-size limit of far addressing on 80x86 machines.
|
| - * On those machines, we expect that jconfig.h will provide a proper value.
|
| - * On machines with 32-bit flat address spaces, any large constant may be used.
|
| + * On machines with flat address spaces, any large constant may be used.
|
| *
|
| * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type
|
| * size_t and will be a multiple of sizeof(align_type).
|
| */
|
|
|
| -#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */
|
| +#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */
|
| #define MAX_ALLOC_CHUNK 1000000000L
|
| #endif
|
|
|
| @@ -100,10 +84,9 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
|
| * Conversely, zero may be returned to always use the minimum amount of memory.
|
| */
|
|
|
| -EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
|
| - size_t min_bytes_needed,
|
| - size_t max_bytes_needed,
|
| - size_t already_allocated));
|
| +EXTERN(size_t) jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
|
| + size_t max_bytes_needed,
|
| + size_t already_allocated);
|
|
|
|
|
| /*
|
| @@ -113,56 +96,53 @@ EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
|
| * are private to the system-dependent backing store routines.
|
| */
|
|
|
| -#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */
|
| +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */
|
|
|
|
|
| -#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */
|
| +#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */
|
|
|
| -typedef unsigned short XMSH; /* type of extended-memory handles */
|
| -typedef unsigned short EMSH; /* type of expanded-memory handles */
|
| +typedef unsigned short XMSH; /* type of extended-memory handles */
|
| +typedef unsigned short EMSH; /* type of expanded-memory handles */
|
|
|
| typedef union {
|
| - short file_handle; /* DOS file handle if it's a temp file */
|
| - XMSH xms_handle; /* handle if it's a chunk of XMS */
|
| - EMSH ems_handle; /* handle if it's a chunk of EMS */
|
| + short file_handle; /* DOS file handle if it's a temp file */
|
| + XMSH xms_handle; /* handle if it's a chunk of XMS */
|
| + EMSH ems_handle; /* handle if it's a chunk of EMS */
|
| } handle_union;
|
|
|
| #endif /* USE_MSDOS_MEMMGR */
|
|
|
| -#ifdef USE_MAC_MEMMGR /* Mac-specific junk */
|
| +#ifdef USE_MAC_MEMMGR /* Mac-specific junk */
|
| #include <Files.h>
|
| #endif /* USE_MAC_MEMMGR */
|
|
|
|
|
| -typedef struct backing_store_struct * backing_store_ptr;
|
| +typedef struct backing_store_struct *backing_store_ptr;
|
|
|
| typedef struct backing_store_struct {
|
| /* Methods for reading/writing/closing this backing-store object */
|
| - JMETHOD(void, read_backing_store, (j_common_ptr cinfo,
|
| - backing_store_ptr info,
|
| - void FAR * buffer_address,
|
| - long file_offset, long byte_count));
|
| - JMETHOD(void, write_backing_store, (j_common_ptr cinfo,
|
| - backing_store_ptr info,
|
| - void FAR * buffer_address,
|
| - long file_offset, long byte_count));
|
| - JMETHOD(void, close_backing_store, (j_common_ptr cinfo,
|
| - backing_store_ptr info));
|
| + void (*read_backing_store) (j_common_ptr cinfo, backing_store_ptr info,
|
| + void *buffer_address, long file_offset,
|
| + long byte_count);
|
| + void (*write_backing_store) (j_common_ptr cinfo, backing_store_ptr info,
|
| + void *buffer_address, long file_offset,
|
| + long byte_count);
|
| + void (*close_backing_store) (j_common_ptr cinfo, backing_store_ptr info);
|
|
|
| /* Private fields for system-dependent backing-store management */
|
| #ifdef USE_MSDOS_MEMMGR
|
| /* For the MS-DOS manager (jmemdos.c), we need: */
|
| - handle_union handle; /* reference to backing-store storage object */
|
| + handle_union handle; /* reference to backing-store storage object */
|
| char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
|
| #else
|
| #ifdef USE_MAC_MEMMGR
|
| /* For the Mac manager (jmemmac.c), we need: */
|
| - short temp_file; /* file reference number to temp file */
|
| - FSSpec tempSpec; /* the FSSpec for the temp file */
|
| + short temp_file; /* file reference number to temp file */
|
| + FSSpec tempSpec; /* the FSSpec for the temp file */
|
| char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */
|
| #else
|
| /* For a typical implementation with temp files, we need: */
|
| - FILE * temp_file; /* stdio reference to temp file */
|
| + FILE *temp_file; /* stdio reference to temp file */
|
| char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */
|
| #endif
|
| #endif
|
| @@ -177,9 +157,9 @@ typedef struct backing_store_struct {
|
| * just take an error exit.)
|
| */
|
|
|
| -EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo,
|
| - backing_store_ptr info,
|
| - long total_bytes_needed));
|
| +EXTERN(void) jpeg_open_backing_store (j_common_ptr cinfo,
|
| + backing_store_ptr info,
|
| + long total_bytes_needed);
|
|
|
|
|
| /*
|
| @@ -194,5 +174,5 @@ EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo,
|
| * all opened backing-store objects have been closed.
|
| */
|
|
|
| -EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo));
|
| -EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo));
|
| +EXTERN(long) jpeg_mem_init (j_common_ptr cinfo);
|
| +EXTERN(void) jpeg_mem_term (j_common_ptr cinfo);
|
|
|