Skip to content

Commit

Permalink
Fix #467, Simplify CF_CFDP_ProcessPollingDirectories()
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Nov 28, 2024
1 parent ba12bc1 commit bc0f23e
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,21 +1479,19 @@ static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *chan)
*-----------------------------------------------------------------*/
void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan)
{
CF_Poll_t * poll;
CF_Poll_t *poll;
CF_ChannelConfig_t *cc;
CF_PollDir_t * pd;
CF_PollDir_t *pd;
int i;
int chan_index;
int count_check;
int ret;

chan_index = (chan - CF_AppData.engine.channels);
cc = &CF_AppData.config_table->chan[chan_index];

for (i = 0; i < CF_MAX_POLLING_DIR_PER_CHAN; ++i)
{
poll = &chan->poll[i];
chan_index = (chan - CF_AppData.engine.channels);
cc = &CF_AppData.config_table->chan[chan_index];
pd = &cc->polldir[i];
count_check = 0;
poll = &chan->poll[i];
pd = &cc->polldir[i];

if (pd->enabled)
{
Expand All @@ -1508,9 +1506,8 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan)
else if (CF_Timer_Expired(&poll->interval_timer))
{
/* the timer has expired */
ret = CF_CFDP_PlaybackDir_Initiate(&poll->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0,
chan_index, pd->priority, pd->dest_eid);
if (!ret)
if (!CF_CFDP_PlaybackDir_Initiate(&poll->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0,
chan_index, pd->priority, pd->dest_eid))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
{
poll->timer_set = 0;
}
Expand All @@ -1532,11 +1529,9 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan)
/* playback is active, so step it */
CF_CFDP_ProcessPlaybackDirectory(chan, &poll->pb);
}

count_check = 1;
}

CF_CFDP_UpdatePollPbCounted(&poll->pb, count_check, &CF_AppData.hk.Payload.channel_hk[chan_index].poll_counter);
CF_CFDP_UpdatePollPbCounted(&poll->pb, pd->enabled, &CF_AppData.hk.Payload.channel_hk[chan_index].poll_counter);
}
}

Expand Down Expand Up @@ -1902,4 +1897,4 @@ void CF_CFDP_MoveFile(const char *src, const char *dest_dir)
{
OS_remove(src);
}
}
}

0 comments on commit bc0f23e

Please sign in to comment.