Anonymous - 2015-03-17

Originally posted by: bill-auger

  • potentially unassigned vars pair_stereo_status, l_pair_idx, r_pair_idx in LinJamConfig::setRemoteStereo()

this is referring to the if switch like:

  int stereo_status = ParseStereoStatus(channel_name) ;
  if (stereo_status != CONFIG::MONO)
  {
    // said vars declared here
    if      (stereo_status == CONFIG::STEREO_L)
      { /* said vars initialized here */ }
    else if (stereo_status == CONFIG::STEREO_R)
      { /* said vars initialized here */ }
    /* said vars referenced here */
  }

this switch is comprehensive as LinJamConfig::ParseStereoStatus() must return one of these three constants

to remove the warning:
* pre-initialize the data (which would result btw in another cppcheck 'efficiency' warning)
* initialize then in a default else block that will never actually execute
* per var nested ternaries would probably shut it up

  expected_pair_name = (stereo_status == CONFIG::STEREO_L) ? r_pair_name :
                       (stereo_status == CONFIG::STEREO_R) ? l_pair_name : -42 ;
  • comment out the final if like:
    else // if (stereo_status == CONFIG::STEREO_R)