Coverage Report

Created: 2026-06-30 07:05

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