Coverage Report

Created: 2026-06-30 08:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/frmts/ceos2/ceossar.c
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  ASI CEOS Translator
4
 * Purpose:  Functions related to CeosSARVolume_t.
5
 * Author:   Paul Lahaie, pjlahaie@atlsci.com
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2000, Atlantis Scientific Inc
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#include "ceos.h"
14
15
extern Link_t *RecipeFunctions;
16
17
void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention)
18
33
{
19
33
    volume->Flavor = volume->Sensor = volume->ProductType = 0;
20
21
33
    volume->FileNamingConvention = file_name_convention;
22
23
33
    volume->VolumeDirectoryFile = volume->SARLeaderFile =
24
33
        volume->SARTrailerFile = volume->NullVolumeDirectoryFile =
25
33
            volume->ImageDesc.ImageDescValid = FALSE;
26
27
33
    volume->RecordList = NULL;
28
33
}
29
30
void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel,
31
                                  int line, int *record, uint64_t *file_offset)
32
94
{
33
94
    struct CeosSARImageDesc *ImageDesc;
34
94
    int TotalRecords = 0;
35
94
    uint64_t TotalBytes = 0;
36
37
94
    if (record)
38
0
        *record = 0;
39
94
    if (file_offset)
40
94
        *file_offset = 0;
41
42
94
    if (volume)
43
94
    {
44
94
        if (volume->ImageDesc.ImageDescValid)
45
94
        {
46
94
            ImageDesc = &(volume->ImageDesc);
47
48
94
            switch (ImageDesc->ChannelInterleaving)
49
94
            {
50
0
                case CEOS_IL_PIXEL:
51
0
                    TotalRecords = (line - 1) * ImageDesc->RecordsPerLine;
52
0
                    TotalBytes =
53
0
                        (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
54
0
                    break;
55
0
                case CEOS_IL_LINE:
56
0
                    TotalRecords =
57
0
                        (ImageDesc->NumChannels * (line - 1) + (channel - 1)) *
58
0
                        ImageDesc->RecordsPerLine;
59
0
                    TotalBytes =
60
0
                        (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
61
0
                    break;
62
94
                case CEOS_IL_BAND:
63
94
                    TotalRecords = (((channel - 1) * ImageDesc->Lines) *
64
94
                                    ImageDesc->RecordsPerLine) +
65
94
                                   (line - 1) * ImageDesc->RecordsPerLine;
66
94
                    TotalBytes =
67
94
                        (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
68
94
                    break;
69
94
            }
70
94
            if (file_offset)
71
94
                *file_offset = ImageDesc->FileDescriptorLength + TotalBytes;
72
94
            if (record)
73
0
                *record = TotalRecords + 1;
74
94
        }
75
94
    }
76
94
}
77
78
int32 GetCeosSARImageData(CPL_UNUSED CeosSARVolume_t *volume,
79
                          CPL_UNUSED CeosRecord_t *processed_data_record,
80
                          CPL_UNUSED int channel, CPL_UNUSED int xoff,
81
                          CPL_UNUSED int xsize, CPL_UNUSED int bufsize,
82
                          CPL_UNUSED uchar *buffer)
83
0
{
84
0
    return 0;
85
0
}
86
87
void DetermineCeosSARPixelOrder(CPL_UNUSED CeosSARVolume_t *volume,
88
                                CPL_UNUSED CeosRecord_t *record)
89
0
{
90
0
}
91
92
void GetCeosSAREmbeddedInfo(CPL_UNUSED CeosSARVolume_t *volume,
93
                            CPL_UNUSED CeosRecord_t *processed_data_record,
94
                            CPL_UNUSED CeosSAREmbeddedInfo_t *info)
95
0
{
96
0
}
97
98
void DeleteCeosSARVolume(CeosSARVolume_t *volume)
99
0
{
100
0
    Link_t *Links;
101
102
0
    if (volume)
103
0
    {
104
0
        if (volume->RecordList)
105
0
        {
106
0
            for (Links = volume->RecordList; Links != NULL; Links = Links->next)
107
0
            {
108
0
                if (Links->object)
109
0
                {
110
0
                    DeleteCeosRecord(Links->object);
111
0
                    Links->object = NULL;
112
0
                }
113
0
            }
114
0
            DestroyList(volume->RecordList);
115
0
        }
116
0
        HFree(volume);
117
0
    }
118
0
}