diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-16 13:27:19 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-16 13:38:49 -0800 |
commit | 36ffdb5239a5f29179a0e09c839089e1704031ed (patch) | |
tree | 2ab220786ccc06a8da632398ad26d262b39a9e36 /src | |
parent | 7899231c65d68d3b0cef0c5a3a5553d9d566ebdc (diff) |
v4l.c: In function 'AddV4LEnc':
v4l.c:920:16: warning: passing argument 1 of 'sprintf' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
920 | sprintf(enc->name,"%s-%s",norm,fixname(input));
| ~~~^~~~~~
In file included from v4l.c:20:
/usr/include/stdio.h:363:38: note: expected 'char * restrict' but argument is of type 'const char *'
363 | extern int sprintf (char *__restrict __s,
| ~~~~~~~~~~~~~~~~~^~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/v4l.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -908,16 +908,23 @@ static int AddV4LEnc(XF86VideoEncodingPtr enc, int entry, char *norm, char *input, int width, int height, int n, int d) { - enc->id = entry; - enc->name = malloc(strlen(norm) + strlen(input) + 2); - if (!enc->name) + char *name; + +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0) + if (Xasprintf(&name, "%s-%s", norm, fixname(input)) < 0) + name = NULL; +#else + name = Xprintf("%s-%s", norm, fixname(input)); +#endif + if (name == NULL) return -1; + enc->id = entry; + enc->name = name; enc->width = width; enc->height = height; enc->rate.numerator = n; enc->rate.denominator = d * 2; /* Refresh rate is twice, due to interlace */ - sprintf(enc->name,"%s-%s",norm,fixname(input)); xf86Msg(X_INFO, "v4l: adding input %s, %dx%d %d fps\n", enc->name, enc->width, enc->height, (d + n - 1)/n); |