mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-05 04:06:34 -05:00
seq: update_group_ports - rewrite blknames update
Resolve the warning bellow and use more optimized calls.
seqmid.c: In function ‘update_group_ports’:
seqmid.c:672:45: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size 61 [-Wformat-truncation=]
672 | ", %s", bp->name);
| ^~
seqmid.c:671:33: note: ‘snprintf’ output between 3 and 130 bytes into a destination of size 63
671 | snprintf(blknames + len, sizeof(blknames) - len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
672 | ", %s", bp->name);
| ~~~~~~~~~~~~~~~~~
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
647c001321
commit
a4e47461ec
1 changed files with 4 additions and 9 deletions
|
|
@ -632,7 +632,6 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
|
||||||
char blknames[64];
|
char blknames[64];
|
||||||
char name[64];
|
char name[64];
|
||||||
unsigned int caps = 0;
|
unsigned int caps = 0;
|
||||||
int len;
|
|
||||||
|
|
||||||
blknames[0] = 0;
|
blknames[0] = 0;
|
||||||
for (b = 0; b < ep->num_blocks; b++) {
|
for (b = 0; b < ep->num_blocks; b++) {
|
||||||
|
|
@ -664,15 +663,11 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*bp->name)
|
if (bp->name[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
len = strlen(blknames);
|
if (blknames[0])
|
||||||
if (len)
|
snd_strlcpy(blknames, ", ", sizeof(blknames));
|
||||||
snprintf(blknames + len, sizeof(blknames) - len,
|
snd_strlcpy(blknames, (const char *)bp->name, sizeof(blknames));
|
||||||
", %s", bp->name);
|
|
||||||
else
|
|
||||||
snd_strlcpy(blknames, (const char *)bp->name,
|
|
||||||
sizeof(blknames));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*blknames)
|
if (!*blknames)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue