Skip to content

Commit ce5206f

Browse files
committed
Fix build with latest ubuntu-24.04:
assigning to 'char *' from 'const char *' discards qualifier
1 parent 59a919d commit ce5206f

5 files changed

Lines changed: 38 additions & 32 deletions

File tree

extractaudio/srtp_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int base64_block_to_octet_triple (char *out, char *in)
5656
int i;
5757

5858
for (i = 0; i < 4; i++) {
59-
char *p = strchr(b64chars, in[i]);
59+
const char *p = strchr(b64chars, in[i]);
6060
if (p != NULL) {
6161
sextets[i] = p - b64chars;
6262
} else{ j++; }

pertools/udp_contention/udp_contention.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct tconf {
9797
int paylen_max;
9898
struct addrinfo *dstaddrs;
9999
int ndstaddrs;
100-
const char *dstaddr;
100+
char *dstaddr;
101101
int dstnetpref;
102102
int test_kind;
103103
uint64_t magic;

src/rtpp_bindargs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct rtpp_bindaddr_params;
3535
#define BINDARG_MAX 16
3636

3737
struct bindarg {
38-
const char *h;
38+
char *h;
3939
struct rtpp_bindaddr_params params;
4040
int is_v6;
4141
};

src/rtpp_controlfd.c

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,28 +134,47 @@ controlfd_init_ifsun(const struct rtpp_cfg *cfsp, struct rtpp_ctrl_sock *csp)
134134
}
135135

136136
static int
137-
controlfd_init_udp(const struct rtpp_cfg *cfsp, struct rtpp_ctrl_sock *csp)
137+
controlfd_setbindhost(const struct rtpp_cfg *cfsp, struct rtpp_ctrl_sock *csp,
138+
struct sockaddr *ifsin, int af)
138139
{
139-
struct sockaddr *ifsin;
140-
char *cp, *tcp = NULL;
141-
int controlfd, so_rcvbuf, i, r;
140+
const char *cp, *bindhost, *port;
141+
char *bindhost_buf;
142+
size_t bindhost_len;
143+
int r;
142144

143145
cp = strrchr(csp->cmd_sock, ':');
144146
if (cp != NULL) {
145-
*cp = '\0';
146-
tcp = cp;
147-
cp++;
147+
bindhost_len = cp - csp->cmd_sock;
148+
bindhost_buf = alloca(bindhost_len + 1);
149+
memcpy(bindhost_buf, csp->cmd_sock, bindhost_len);
150+
bindhost_buf[bindhost_len] = '\0';
151+
bindhost = bindhost_buf;
152+
port = cp + 1;
153+
} else {
154+
bindhost = csp->cmd_sock;
155+
port = CPORT;
148156
}
149-
if (cp == NULL || *cp == '\0')
150-
cp = CPORT;
151-
csp->port_ctl = atoi(cp);
157+
if (*port == '\0')
158+
port = CPORT;
159+
csp->port_ctl = atoi(port);
160+
r = setbindhost(ifsin, af, bindhost, port, cfsp->no_resolve);
161+
if (r != 0) {
162+
warnx("setbindhost failed");
163+
return (-1);
164+
}
165+
return (0);
166+
}
167+
168+
static int
169+
controlfd_init_udp(const struct rtpp_cfg *cfsp, struct rtpp_ctrl_sock *csp)
170+
{
171+
struct sockaddr *ifsin;
172+
int controlfd, so_rcvbuf, i, r;
173+
152174
i = (csp->type == RTPC_UDP6) ? AF_INET6 : AF_INET;
153175
ifsin = sstosa(&csp->bindaddr);
154-
r = setbindhost(ifsin, i, csp->cmd_sock, cp, cfsp->no_resolve);
155-
if (tcp != NULL)
156-
*tcp = ':';
176+
r = controlfd_setbindhost(cfsp, csp, ifsin, i);
157177
if (r != 0) {
158-
warnx("setbindhost failed");
159178
return (-1);
160179
}
161180
controlfd = socket(i, SOCK_DGRAM, 0);
@@ -179,25 +198,12 @@ static int
179198
controlfd_init_tcp(const struct rtpp_cfg *cfsp, struct rtpp_ctrl_sock *csp)
180199
{
181200
struct sockaddr *ifsin;
182-
char *cp, *tcp = NULL;;
183201
int controlfd, so_rcvbuf, i, r;
184202

185-
cp = strrchr(csp->cmd_sock, ':');
186-
if (cp != NULL) {
187-
*cp = '\0';
188-
tcp = cp;
189-
cp++;
190-
}
191-
if (cp == NULL || *cp == '\0')
192-
cp = CPORT;
193-
csp->port_ctl = atoi(cp);
194203
i = (csp->type == RTPC_TCP6) ? AF_INET6 : AF_INET;
195204
ifsin = sstosa(&csp->bindaddr);
196-
r = setbindhost(ifsin, i, csp->cmd_sock, cp, cfsp->no_resolve);
197-
if (tcp != NULL)
198-
*tcp = ':';
205+
r = controlfd_setbindhost(cfsp, csp, ifsin, i);
199206
if (r != 0) {
200-
warnx("setbindhost failed");
201207
return (-1);
202208
}
203209
controlfd = socket(i, SOCK_STREAM, 0);

src/rtpp_tnotify_set.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ rtpp_tnotify_set_lookup(struct rtpp_tnotify_set *pub, const char *socket_name,
379379
struct rtpp_tnotify_set_priv *pvt;
380380
struct rtpp_tnotify_wildcard *wp;
381381
int i;
382-
char *sep;
382+
const char *sep;
383383

384384
PUB2PVT(pub, pvt);
385385
for (i = 0; i < pvt->tp_len; i++) {

0 commit comments

Comments
 (0)