Coverage Report

Created: 2026-10-13 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pupnp/upnp/src/api/UpnpFileInfo.c
Line
Count
Source
1
/*!
2
 * \file
3
 *
4
 * \brief Source file for UpnpFileInfo methods.
5
 *
6
 * Do not edit this file, it is automatically generated. Please look at
7
 * generator.c.
8
 *
9
 * \author Marcelo Roberto Jimenez
10
 */
11
#include "UpnpString.h"
12
#include "config.h" // IWYU pragma: keep
13
#include "ixml.h"
14
#include "list.h"
15
16
#include <stdlib.h> /* for calloc(), free() */       // IWYU pragma: keep
17
#include <string.h> /* for strlen(), strdup(), memset() */ // IWYU pragma: keep
18
#include <sys/types.h>
19
#include <time.h>
20
21
#include "UpnpFileInfo.h"
22
23
struct s_UpnpFileInfo
24
{
25
  off_t m_FileLength;
26
  time_t m_LastModified;
27
  int m_IsDirectory;
28
  int m_IsReadable;
29
  DOMString m_ContentType;
30
  UpnpListHead m_ExtraHeadersList;
31
  struct sockaddr_storage m_CtrlPtIPAddr;
32
  UpnpString *m_Os;
33
};
34
35
UpnpFileInfo *UpnpFileInfo_new(void)
36
0
{
37
0
  struct s_UpnpFileInfo *p = calloc(1, sizeof(struct s_UpnpFileInfo));
38
39
0
  if (!p)
40
0
    return 0;
41
42
  /*p->m_FileLength = 0;*/
43
  /*p->m_LastModified = 0;*/
44
  /*p->m_IsDirectory = 0;*/
45
  /*p->m_IsReadable = 0;*/
46
  /*p->m_ContentType = 0;*/
47
0
  UpnpListInit(&p->m_ExtraHeadersList);
48
  /* memset(&p->m_CtrlPtIPAddr, 0, sizeof (struct sockaddr_storage)); */
49
0
  p->m_Os = UpnpString_new();
50
51
0
  return (UpnpFileInfo *)p;
52
0
}
53
54
void UpnpFileInfo_delete(UpnpFileInfo *q)
55
0
{
56
0
  struct s_UpnpFileInfo *p = (struct s_UpnpFileInfo *)q;
57
58
0
  if (!p)
59
0
    return;
60
61
0
  UpnpString_delete(p->m_Os);
62
0
  p->m_Os = 0;
63
0
  memset(&p->m_CtrlPtIPAddr, 0, sizeof(struct sockaddr_storage));
64
0
  UpnpListInit(&p->m_ExtraHeadersList);
65
0
  ixmlFreeDOMString(p->m_ContentType);
66
0
  p->m_ContentType = 0;
67
0
  p->m_IsReadable = 0;
68
0
  p->m_IsDirectory = 0;
69
0
  p->m_LastModified = 0;
70
0
  p->m_FileLength = 0;
71
72
0
  free(p);
73
0
}
74
75
int UpnpFileInfo_assign(UpnpFileInfo *p, const UpnpFileInfo *q)
76
0
{
77
0
  int ok = 1;
78
79
0
  if (p != q) {
80
0
    ok = ok && UpnpFileInfo_set_FileLength(
81
0
           p, UpnpFileInfo_get_FileLength(q));
82
0
    ok = ok && UpnpFileInfo_set_LastModified(
83
0
           p, UpnpFileInfo_get_LastModified(q));
84
0
    ok = ok && UpnpFileInfo_set_IsDirectory(
85
0
           p, UpnpFileInfo_get_IsDirectory(q));
86
0
    ok = ok && UpnpFileInfo_set_IsReadable(
87
0
           p, UpnpFileInfo_get_IsReadable(q));
88
0
    ok = ok && UpnpFileInfo_set_ContentType(
89
0
           p, UpnpFileInfo_get_ContentType(q));
90
0
    ok = ok && UpnpFileInfo_set_ExtraHeadersList(
91
0
           p, UpnpFileInfo_get_ExtraHeadersList(q));
92
0
    ok = ok && UpnpFileInfo_set_CtrlPtIPAddr(
93
0
           p, UpnpFileInfo_get_CtrlPtIPAddr(q));
94
0
    ok = ok && UpnpFileInfo_set_Os(p, UpnpFileInfo_get_Os(q));
95
0
  }
96
97
0
  return ok;
98
0
}
99
100
UpnpFileInfo *UpnpFileInfo_dup(const UpnpFileInfo *q)
101
0
{
102
0
  UpnpFileInfo *p = UpnpFileInfo_new();
103
104
0
  if (!p)
105
0
    return 0;
106
107
0
  UpnpFileInfo_assign(p, q);
108
109
0
  return p;
110
0
}
111
112
off_t UpnpFileInfo_get_FileLength(const UpnpFileInfo *p)
113
0
{
114
0
  return p->m_FileLength;
115
0
}
116
117
int UpnpFileInfo_set_FileLength(UpnpFileInfo *p, off_t n)
118
0
{
119
0
  p->m_FileLength = n;
120
121
0
  return 1;
122
0
}
123
124
time_t UpnpFileInfo_get_LastModified(const UpnpFileInfo *p)
125
0
{
126
0
  return p->m_LastModified;
127
0
}
128
129
int UpnpFileInfo_set_LastModified(UpnpFileInfo *p, time_t n)
130
0
{
131
0
  p->m_LastModified = n;
132
133
0
  return 1;
134
0
}
135
136
int UpnpFileInfo_get_IsDirectory(const UpnpFileInfo *p)
137
0
{
138
0
  return p->m_IsDirectory;
139
0
}
140
141
int UpnpFileInfo_set_IsDirectory(UpnpFileInfo *p, int n)
142
0
{
143
0
  p->m_IsDirectory = n;
144
145
0
  return 1;
146
0
}
147
148
int UpnpFileInfo_get_IsReadable(const UpnpFileInfo *p)
149
0
{
150
0
  return p->m_IsReadable;
151
0
}
152
153
int UpnpFileInfo_set_IsReadable(UpnpFileInfo *p, int n)
154
0
{
155
0
  p->m_IsReadable = n;
156
157
0
  return 1;
158
0
}
159
160
const DOMString UpnpFileInfo_get_ContentType(const UpnpFileInfo *p)
161
0
{
162
0
  return p->m_ContentType;
163
0
}
164
165
int UpnpFileInfo_set_ContentType(UpnpFileInfo *p, const DOMString s)
166
0
{
167
0
  DOMString q = ixmlCloneDOMString(s);
168
0
  if (!q)
169
0
    return 0;
170
0
  ixmlFreeDOMString(p->m_ContentType);
171
0
  p->m_ContentType = q;
172
173
0
  return 1;
174
0
}
175
176
const char *UpnpFileInfo_get_ContentType_cstr(const UpnpFileInfo *p)
177
0
{
178
0
  return (const char *)UpnpFileInfo_get_ContentType(p);
179
0
}
180
181
const UpnpListHead *UpnpFileInfo_get_ExtraHeadersList(const UpnpFileInfo *p)
182
0
{
183
0
  return &p->m_ExtraHeadersList;
184
0
}
185
186
int UpnpFileInfo_set_ExtraHeadersList(UpnpFileInfo *p, const UpnpListHead *q)
187
0
{
188
0
  p->m_ExtraHeadersList = *q;
189
190
0
  return 1;
191
0
}
192
193
void UpnpFileInfo_add_to_list_ExtraHeadersList(
194
  UpnpFileInfo *p, struct UpnpListHead *head)
195
0
{
196
0
  UpnpListHead *list = &p->m_ExtraHeadersList;
197
0
  UpnpListInsert(list, UpnpListEnd(list), head);
198
0
}
199
200
const struct sockaddr_storage *UpnpFileInfo_get_CtrlPtIPAddr(
201
  const UpnpFileInfo *p)
202
0
{
203
0
  return &p->m_CtrlPtIPAddr;
204
0
}
205
206
int UpnpFileInfo_set_CtrlPtIPAddr(
207
  UpnpFileInfo *p, const struct sockaddr_storage *buf)
208
0
{
209
0
  p->m_CtrlPtIPAddr = *buf;
210
211
0
  return 1;
212
0
}
213
214
void UpnpFileInfo_clear_CtrlPtIPAddr(UpnpFileInfo *p)
215
0
{
216
0
  memset(&p->m_CtrlPtIPAddr, 0, sizeof(struct sockaddr_storage));
217
0
}
218
219
0
const UpnpString *UpnpFileInfo_get_Os(const UpnpFileInfo *p) { return p->m_Os; }
220
221
int UpnpFileInfo_set_Os(UpnpFileInfo *p, const UpnpString *s)
222
0
{
223
0
  const char *q = UpnpString_get_String(s);
224
225
0
  return UpnpString_set_String(p->m_Os, q);
226
0
}
227
228
size_t UpnpFileInfo_get_Os_Length(const UpnpFileInfo *p)
229
0
{
230
0
  return UpnpString_get_Length(UpnpFileInfo_get_Os(p));
231
0
}
232
233
const char *UpnpFileInfo_get_Os_cstr(const UpnpFileInfo *p)
234
0
{
235
0
  return UpnpString_get_String(UpnpFileInfo_get_Os(p));
236
0
}
237
238
int UpnpFileInfo_strcpy_Os(UpnpFileInfo *p, const char *s)
239
0
{
240
0
  return UpnpString_set_String(p->m_Os, s);
241
0
}
242
243
int UpnpFileInfo_strncpy_Os(UpnpFileInfo *p, const char *s, size_t n)
244
0
{
245
0
  return UpnpString_set_StringN(p->m_Os, s, n);
246
0
}
247
248
0
void UpnpFileInfo_clear_Os(UpnpFileInfo *p) { UpnpString_clear(p->m_Os); }