ref: 2438b313231c43d55e18b54780566dad55914a7b
parent: bcd57f412aef661311bf8cf4007114483973ad59
author: Martin Storsjö <[email protected]>
date: Tue Feb 18 06:52:14 EST 2014
Don't needlessly copy the input parameter struct
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -212,11 +212,8 @@
SWelsSvcCodingParam sConfig (true);
if(iInitType == INIT_TYPE_PARAMETER_BASED)
{
- SEncParamBase sEncodingParam;
- memcpy (&sEncodingParam, argv, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage
-
// Convert SEncParamBase into WelsSVCParamConfig here..
- if (sConfig.ParamBaseTranscode (sEncodingParam, true)) {
+ if (sConfig.ParamBaseTranscode (*argv, true)) {
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n");
Uninitialize();
return cmInitParaError;
@@ -224,10 +221,8 @@
}
else if(iInitType == INIT_TYPE_PARAMETER_EXT)
{
- SEncParamExt sEncodingParam;
- memcpy (&sEncodingParam, argv, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
- // Convert SEncParamBase into WelsSVCParamConfig here..
- if (sConfig.ParamTranscode (sEncodingParam, true)) {
+ // Convert SEncParamExt into WelsSVCParamConfig here..
+ if (sConfig.ParamTranscode (*(const SEncParamExt*)argv, true)) {
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n");
Uninitialize();
return cmInitParaError;