obs-ffmpeg: Fix compiler warnings

* obs-ffmpeg: Fix format-overflow warning

* obs-ffmpeg: Fix unused-parameter warnings
This commit is contained in:
tytan652 2021-12-23 20:15:32 +01:00 committed by Jim
parent c98617849a
commit ce62240530
2 changed files with 13 additions and 2 deletions

View File

@ -202,6 +202,9 @@ static bool nvenc_reconfigure(void *data, obs_data_t *settings)
enc->ffve.context->bit_rate = rate;
enc->ffve.context->rc_max_rate = rate;
}
#else
UNUSED_PARAMETER(data);
UNUSED_PARAMETER(settings);
#endif
return true;
}

View File

@ -600,8 +600,16 @@ static obs_properties_t *vaapi_properties(void *unused)
strcmp(file_name, "..") == 0)
continue;
char path[64] = "\0";
sprintf(path, "/dev/dri/by-path/%s", file_name);
char path[64] = {0};
// Use the return value of snprintf to prevent truncation warning.
int written = snprintf(path, 64, "/dev/dri/by-path/%s",
file_name);
if (written >= 64)
blog(LOG_DEBUG,
"obs-ffmpeg-vaapi: A format truncation may have occurred."
" This can be ignored since it is quite improbable.");
type = strrchr(file_name, '-');
if (type == NULL)
continue;