code: (sn)printf automatically zero-terminates strings

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-08-28 15:53:01 +02:00
parent 24a19c2ed3
commit b9d8583d58
4 changed files with 9 additions and 9 deletions

View file

@ -56,7 +56,7 @@ bool dnxhd_handler::has_pixel_format_support(ffmpeg_factory* instance)
inline const char* dnx_profile_to_display_name(const char* profile)
{
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", S_CODEC_DNXHR_PROFILE, profile);
snprintf(buffer, sizeof(buffer), "%s.%s", S_CODEC_DNXHR_PROFILE, profile);
return D_TRANSLATE(buffer);
}

View file

@ -143,7 +143,7 @@ void nvenc_h264_handler::get_encoder_properties(obs_properties_t* props, const A
streamfx::ffmpeg::tools::avoption_list_add_entries(
context->priv_data, "profile", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", S_CODEC_H264_PROFILE, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", S_CODEC_H264_PROFILE, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}

View file

@ -146,7 +146,7 @@ void nvenc_hevc_handler::get_encoder_properties(obs_properties_t* props, const A
streamfx::ffmpeg::tools::avoption_list_add_entries(
context->priv_data, "profile", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", S_CODEC_HEVC_PROFILE, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", S_CODEC_HEVC_PROFILE, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}
@ -156,7 +156,7 @@ void nvenc_hevc_handler::get_encoder_properties(obs_properties_t* props, const A
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_DEFAULT), -1);
streamfx::ffmpeg::tools::avoption_list_add_entries(context->priv_data, "tier", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", S_CODEC_HEVC_TIER, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", S_CODEC_HEVC_TIER, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}

View file

@ -256,7 +256,7 @@ void nvenc::get_properties_pre(obs_properties_t* props, const AVCodec*, const AV
OBS_COMBO_FORMAT_STRING);
streamfx::ffmpeg::tools::avoption_list_add_entries(context->priv_data, "preset", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", ST_I18N_PRESET, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", ST_I18N_PRESET, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}
@ -266,7 +266,7 @@ void nvenc::get_properties_pre(obs_properties_t* props, const AVCodec*, const AV
OBS_COMBO_FORMAT_STRING);
streamfx::ffmpeg::tools::avoption_list_add_entries(context->priv_data, "tune", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", ST_I18N_TUNE, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", ST_I18N_TUNE, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}
@ -293,7 +293,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec, c
return;
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", ST_I18N_RATECONTROL_MODE, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", ST_I18N_RATECONTROL_MODE, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}
@ -306,7 +306,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec, c
streamfx::ffmpeg::tools::avoption_list_add_entries(
context->priv_data, "multipass", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", ST_I18N_RATECONTROL_MULTIPASS, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", ST_I18N_RATECONTROL_MULTIPASS, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
} else {
@ -441,7 +441,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec, c
streamfx::ffmpeg::tools::avoption_list_add_entries(
context->priv_data, "b_ref_mode", [&p](const AVOption* opt) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.%s\0", ST_I18N_OTHER_BFRAMEREFERENCEMODE, opt->name);
snprintf(buffer, sizeof(buffer), "%s.%s", ST_I18N_OTHER_BFRAMEREFERENCEMODE, opt->name);
obs_property_list_add_string(p, D_TRANSLATE(buffer), opt->name);
});
}