Coverage Report

Created: 2025-08-11 08:01

/src/libtiff/libtiff/tif_jpeg_12.c
Line
Count
Source (jump to first uncovered line)
1
2
#include "tiffiop.h"
3
4
#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
5
#define JPEG_DUAL_MODE_8_12
6
#endif
7
8
#if defined(JPEG_DUAL_MODE_8_12)
9
10
#define FROM_TIF_JPEG_12
11
12
#ifdef TIFFInitJPEG
13
#undef TIFFInitJPEG
14
#endif
15
#define TIFFInitJPEG TIFFInitJPEG_12
16
17
#ifdef TIFFJPEGIsFullStripRequired
18
#undef TIFFJPEGIsFullStripRequired
19
#endif
20
#define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12
21
22
int TIFFInitJPEG_12(TIFF *tif, int scheme);
23
24
#if !defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
25
#include LIBJPEG_12_PATH
26
#endif
27
28
#include "tif_jpeg.c"
29
30
int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings,
31
                      int scheme, int is_encode)
32
2.14k
{
33
2.14k
    JPEGState *sp;
34
2.14k
    uint8_t *new_tif_data;
35
36
2.14k
    (void)scheme;
37
2.14k
    assert(scheme == COMPRESSION_JPEG);
38
39
2.14k
    new_tif_data =
40
2.14k
        (uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState));
41
42
2.14k
    if (new_tif_data == NULL)
43
0
    {
44
0
        TIFFErrorExtR(tif, "TIFFReInitJPEG_12",
45
0
                      "No space for JPEG state block");
46
0
        return 0;
47
0
    }
48
49
2.14k
    tif->tif_data = new_tif_data;
50
2.14k
    _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
51
52
2.14k
    TIFFInitJPEGCommon(tif);
53
54
2.14k
    sp = JState(tif);
55
2.14k
    sp->otherSettings = *otherSettings;
56
57
2.14k
    if (is_encode)
58
0
        return JPEGSetupEncode(tif);
59
2.14k
    else
60
2.14k
        return JPEGSetupDecode(tif);
61
2.14k
}
62
63
#endif /* defined(JPEG_DUAL_MODE_8_12) */