src/java.desktop/share/native/libjavajpeg/jinclude.h
author jiefu
Fri, 15 Nov 2019 20:39:26 +0800
changeset 59110 8c4c358272a9
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234232: [TESTBUG] gc/shenandoah/jvmti/TestHeapDump.java fails with -Xcomp Reviewed-by: zgu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * jinclude.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * Copyright (C) 1991-1994, Thomas G. Lane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This file is part of the Independent JPEG Group's software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * For conditions of distribution and use, see the accompanying README file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * This file exists to provide a single place to fix any problems with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * including the wrong system include files.  (Common problems are taken
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * care of by the standard jconfig symbols, but on really weird systems
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * you may have to edit this file.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * NOTE: this file is NOT intended to be included by applications using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * JPEG library.  Most applications need only include jpeglib.h.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
/* Include auto-config file to find out which system include files we need. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#include "jconfig.h"            /* auto configuration options */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
#define JCONFIG_INCLUDED        /* so that jpeglib.h doesn't do it again */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * We need the NULL macro and size_t typedef.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * On an ANSI-conforming system it is sufficient to include <stddef.h>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * pull in <sys/types.h> as well.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Note that the core JPEG library does not require <stdio.h>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * only the default error handler and data source/destination modules do.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * But we must pull it in because of the references to FILE in jpeglib.h.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * You can remove those references if you want to compile without <stdio.h>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#ifdef HAVE_STDDEF_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include <stddef.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#ifdef HAVE_STDLIB_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#ifdef NEED_SYS_TYPES_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#include <sys/types.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * We need memory copying and zeroing functions, plus strncpy().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * ANSI and System V implementations declare these in <string.h>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * Some systems may declare memset and memcpy in <memory.h>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * NOTE: we assume the size parameters to these functions are of type size_t.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * Change the casts in these macros if not!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#ifdef NEED_BSD_STRINGS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#include <strings.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#define MEMCOPY(dest,src,size)  bcopy((const void *)(src), (void *)(dest), (size_t)(size))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#else /* not BSD, assume ANSI/SysV string lib */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define MEMCOPY(dest,src,size)  memcpy((void *)(dest), (const void *)(src), (size_t)(size))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * In ANSI C, and indeed any rational implementation, size_t is also the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * type returned by sizeof().  However, it seems there are some irrational
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * implementations out there, in which sizeof() returns an int even though
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * size_t is defined as long or unsigned long.  To ensure consistent results
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * we always use this SIZEOF() macro in place of using sizeof() directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
#define SIZEOF(object)  ((size_t) sizeof(object))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * The modules that use fread() and fwrite() always invoke them through
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * these macros.  On some systems you may need to twiddle the argument casts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * CAUTION: argument order is different from underlying functions!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#define JFREAD(file,buf,sizeofbuf)  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define JFWRITE(file,buf,sizeofbuf)  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))