From f42e647430d037afa5595081301a56deba9353af Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 21 Apr 2022 09:32:28 +0200 Subject: [PATCH] cellVdec: use av_error_to_string --- rpcs3/Emu/Cell/Modules/cellVdec.cpp | 12 +++--------- rpcs3/util/media_utils.cpp | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index 942d07e8ce..63f2686900 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -390,9 +390,7 @@ struct vdec_context final if (int ret = avcodec_send_packet(ctx, &packet); ret < 0) { - char av_error[AV_ERROR_MAX_STRING_SIZE]{}; - av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret); - fmt::throw_exception("AU queuing error(0x%x): %s", ret, av_error); + fmt::throw_exception("AU queuing error(0x%x): %s", ret, utils::av_error_to_string(ret)); } else { @@ -414,9 +412,7 @@ struct vdec_context final break; } - char av_error[AV_ERROR_MAX_STRING_SIZE]{}; - av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret); - fmt::throw_exception("AU decoding error(0x%x): %s", ret, av_error); + fmt::throw_exception("AU decoding error(0x%x): %s", ret, utils::av_error_to_string(ret)); } if (frame->interlaced_frame) @@ -1209,9 +1205,7 @@ error_code cellVdecGetPictureExt(u32 handle, vm::cptr format if (const int ret = av_image_fill_linesizes(out_line, out_f, w); ret < 0) { - char av_error[AV_ERROR_MAX_STRING_SIZE]{}; - av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, ret); - fmt::throw_exception("cellVdecGetPicture: av_image_fill_linesizes failed (ret=0x%x): %s", ret, av_error); + fmt::throw_exception("cellVdecGetPicture: av_image_fill_linesizes failed (ret=0x%x): %s", ret, utils::av_error_to_string(ret)); } } diff --git a/rpcs3/util/media_utils.cpp b/rpcs3/util/media_utils.cpp index c1f3524c5e..fde01871f7 100644 --- a/rpcs3/util/media_utils.cpp +++ b/rpcs3/util/media_utils.cpp @@ -57,7 +57,7 @@ namespace utils std::string av_error_to_string(int error) { - char av_error[AV_ERROR_MAX_STRING_SIZE]; + char av_error[AV_ERROR_MAX_STRING_SIZE]{}; av_make_error_string(av_error, AV_ERROR_MAX_STRING_SIZE, error); return av_error; }