local variable smell ussue
Submitted by Zsolt Szalai
Link to original bug (#495150)
Description
hi,
titanium reports these issues:
The variable v_connId' seems to be never written, maybe it could be a constant;VS_ProactiveTranscoding_functions.ttcnpp;1804 and The variable
v_connId' seems to be never used locally;VS_ProactiveTranscoding_functions.ttcnpp;1804
on below code.
That is, the variable is used as an inout parameter of a function. I think in that case here, the issue should not be reported. In the function with inout parameter the issue shall anyway be reported if that is not written or used.
function f_setSbgvProactiveTranscodingProfile() runs on Mtc_CT { var boolean v_success := false; var GenericMessage v_reply; var integer v_connId := 0; var charstring v_proactiveTranscodingProfile := "TranscoProfile1";
f_ts_imsAdmin_start("SBGNetconf",{c_NETCONF}); // Get nodes with netconf interfaces var NodeIdList v_nodeList := f_config_searchNode({{interface := netconf},{application := "SBG"}}); // Get the specific interface var NodeInterfaceList v_netconfInterfaces := f_config_getInterfaces(v_nodeList[0]); // Send SSH connect and the netconf "Hello" message, returns in v_reply the capabilities list
v_success := f_ts_imsAdmin_netconfConnect(v_netconfInterfaces[0], v_reply, "SBGNetconf",v_connId);
v_success := f_ts_imsAdmin_sendNetconfRequest(v_reply, "SBGNetconf", v_connId, valueof(t_netconfConfigSetSBGProactiveTranscodingProfile_sbgv("1", v_proactiveTranscodingProfile))); // Create a list of codecs for the profile
if (v_success)
{
v_success := f_ts_imsAdmin_sendNetconfRequest(v_reply, "SBGNetconf", v_connId, valueof(t_netconfConfigActivateSBGProactiveTranscodingProfile_sbgv("2", v_proactiveTranscodingProfile))); // Activate Proactive Transcoding
v_success := f_ts_imsAdmin_sendNetconfRequest(v_reply, "SBGNetconf", v_connId, valueof(t_netconfConfigGetActiveSBGProactiveTranscodingProfile_sbgv("3"))); // Check if Proactive transcoding is activated.
var charstring v_pattern1 := "()<proactiveTranscodingProfile>
()</proactiveTranscodingProfile>
(*)";
var charstring v_value := f_checkValueFromValuePairList(v_reply.msg[0].genericReply.data[0].valueList,"RESULT");
var charstring v_value1 := regexp(v_value, v_pattern1, 1);
if(v_value1 == v_proactiveTranscodingProfile)
{
f_debug("#### Proactive Transcoding profile "&v_value1&" is activated");
setverdict(pass);
}
else
{
f_debug("#### Proactive Transcoding profile "&v_value1&" is not activated");
setverdict(fail);
}
} else { setverdict(fail,"#### Proactive Transcoding profile "&v_proactiveTranscodingProfile&" is not created"); } // Take down the netconf connection if(not(f_ts_imsAdmin_netconfDisconnect(v_reply, "SBGNetconf", v_connId))) { f_debug("Failed to disconnect Netconf"); setverdict(fail); } }
Version: 5.5.0