From b9d8583d58d7d3124960ceabae085dedd27caaf4 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 28 Aug 2022 15:53:01 +0200 Subject: [PATCH] code: (sn)printf automatically zero-terminates strings --- source/encoders/handlers/dnxhd_handler.cpp | 2 +- source/encoders/handlers/nvenc_h264_handler.cpp | 2 +- source/encoders/handlers/nvenc_hevc_handler.cpp | 4 ++-- source/encoders/handlers/nvenc_shared.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/encoders/handlers/dnxhd_handler.cpp b/source/encoders/handlers/dnxhd_handler.cpp index f8c8fd3b..0c18a936 100644 --- a/source/encoders/handlers/dnxhd_handler.cpp +++ b/source/encoders/handlers/dnxhd_handler.cpp @@ -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); } diff --git a/source/encoders/handlers/nvenc_h264_handler.cpp b/source/encoders/handlers/nvenc_h264_handler.cpp index a4ddac33..0e32b6c2 100644 --- a/source/encoders/handlers/nvenc_h264_handler.cpp +++ b/source/encoders/handlers/nvenc_h264_handler.cpp @@ -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); }); } diff --git a/source/encoders/handlers/nvenc_hevc_handler.cpp b/source/encoders/handlers/nvenc_hevc_handler.cpp index 570f8f26..7c776749 100644 --- a/source/encoders/handlers/nvenc_hevc_handler.cpp +++ b/source/encoders/handlers/nvenc_hevc_handler.cpp @@ -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); }); } diff --git a/source/encoders/handlers/nvenc_shared.cpp b/source/encoders/handlers/nvenc_shared.cpp index a12445b4..4f978ec3 100644 --- a/source/encoders/handlers/nvenc_shared.cpp +++ b/source/encoders/handlers/nvenc_shared.cpp @@ -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); }); }