[dacp/db] Fix issue found with scan-build

- Result of operation is garbage or undefined in dacp_reply_cue_play
- Uninitialized argument value in dacp_reply_playqueuecontents
- Uninitialized argument value in queue_fetch_byposrelativetoitem
This commit is contained in:
chme 2017-01-20 17:03:45 +01:00
parent 4e869f6fda
commit 6163269832
2 changed files with 10 additions and 8 deletions

View File

@ -4691,7 +4691,10 @@ queue_fetch_byposrelativetoitem(int pos, uint32_t item_id, char shuffle, struct
ret = queue_fetch_bypos(pos_absolute, shuffle, queue_item, with_metadata);
DPRINTF(E_DBG, L_DB, "Fetch by pos: fetched item (id=%d, pos=%d, file-id=%d)\n", queue_item->id, queue_item->pos, queue_item->file_id);
if (ret < 0)
DPRINTF(E_LOG, L_DB, "Error fetching item by pos: pos (%d) relative to item with id (%d)\n", pos, item_id);
else
DPRINTF(E_DBG, L_DB, "Fetch by pos: fetched item (id=%d, pos=%d, file-id=%d)\n", queue_item->id, queue_item->pos, queue_item->file_id);
return ret;
}

View File

@ -1017,6 +1017,8 @@ dacp_reply_cue_play(struct evhttp_request *req, struct evbuffer *evbuf, char **u
}
}
player_get_status(&status);
cuequery = evhttp_find_header(query, "query");
if (cuequery)
{
@ -1031,12 +1033,9 @@ dacp_reply_cue_play(struct evhttp_request *req, struct evbuffer *evbuf, char **u
return;
}
}
else
else if (status.status != PLAY_STOPPED)
{
player_get_status(&status);
if (status.status != PLAY_STOPPED)
player_playback_stop();
player_playback_stop();
}
param = evhttp_find_header(query, "dacp.shufflestate");
@ -1597,6 +1596,8 @@ dacp_reply_playqueuecontents(struct evhttp_request *req, struct evbuffer *evbuf,
return;
}
player_get_status(&status);
/*
* If the span parameter is negativ make song list for Previously Played,
* otherwise make song list for Up Next and begin with first song after playlist position.
@ -1626,8 +1627,6 @@ dacp_reply_playqueuecontents(struct evhttp_request *req, struct evbuffer *evbuf,
}
else
{
player_get_status(&status);
memset(&query_params, 0, sizeof(struct query_params));
if (status.shuffle)
query_params.sort = S_SHUFFLE_POS;