src/java.desktop/share/native/libjavajpeg/jmemnobs.c
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
 * jmemnobs.c
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * Copyright (C) 1992-1996, 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 provides a really simple implementation of the system-
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * dependent portion of the JPEG memory manager.  This implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * assumes that no backing-store files are needed: all required space
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * can be obtained from malloc().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * This is very portable in the sense that it'll compile on almost anything,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * but you'd better have lots of main memory (or virtual memory) if you want
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * to process big images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Note that the max_memory_to_use option is ignored by this implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
#define JPEG_INTERNALS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
#include "jinclude.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#include "jpeglib.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
#include "jmemsys.h"            /* import the system-dependent declarations */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#ifndef HAVE_STDLIB_H           /* <stdlib.h> should declare malloc(),free() */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
extern void * malloc JPP((size_t size));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
extern void free JPP((void *ptr));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Memory allocation and freeing are controlled by the regular library
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * routines malloc() and free().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
GLOBAL(void *)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  return (void *) malloc(sizeofobject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
GLOBAL(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  free(object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * "Large" objects are treated the same as "small" ones.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * NB: although we include FAR keywords in the routine declarations,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * this file won't actually work in 80x86 small/medium model; at least,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * you probably won't be able to process useful-size images in only 64KB.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
GLOBAL(void FAR *)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  return (void FAR *) malloc(sizeofobject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
GLOBAL(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  free(object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * This routine computes the total memory space available for allocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * Here we always say, "we got all you want bud!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
8355
6b58fe58e767 6989774: imageio compiler warnings in native code
bae
parents: 2
diff changeset
    76
GLOBAL(size_t)
6b58fe58e767 6989774: imageio compiler warnings in native code
bae
parents: 2
diff changeset
    77
jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
6b58fe58e767 6989774: imageio compiler warnings in native code
bae
parents: 2
diff changeset
    78
                    size_t max_bytes_needed, size_t already_allocated)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  return max_bytes_needed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * Backing store (temporary file) management.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * Since jpeg_mem_available always promised the moon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * this should never be called and we can just error out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
GLOBAL(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                         long total_bytes_needed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * These routines take care of any system-dependent initialization and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * cleanup required.  Here, there isn't any.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
8355
6b58fe58e767 6989774: imageio compiler warnings in native code
bae
parents: 2
diff changeset
   103
GLOBAL(size_t)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
jpeg_mem_init (j_common_ptr cinfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  return 0;                     /* just set max_memory_to_use to 0 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
GLOBAL(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
jpeg_mem_term (j_common_ptr cinfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  /* no work */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
}