Indentation

This commit is contained in:
ejurgensen 2014-05-04 22:36:37 +02:00
parent 7e43a42c88
commit 305c1a141c
2 changed files with 52 additions and 53 deletions

View File

@ -1216,7 +1216,7 @@ dacp_reply_playqueuecontents(struct evhttp_request *req, struct evbuffer *evbuf,
{ {
ret = safe_atoi32(param, &span); ret = safe_atoi32(param, &span);
if (ret < 0) if (ret < 0)
DPRINTF(E_LOG, L_DACP, "Invalid span value in playqueue-contents request\n"); DPRINTF(E_LOG, L_DACP, "Invalid span value in playqueue-contents request\n");
} }
songlist = NULL; songlist = NULL;
@ -1241,54 +1241,53 @@ dacp_reply_playqueuecontents(struct evhttp_request *req, struct evbuffer *evbuf,
* otherwise make song list for Up Next and begin with first song after playlist position. * otherwise make song list for Up Next and begin with first song after playlist position.
*/ */
if (span < 0) if (span < 0)
{ {
history = player_history_get(); history = player_history_get();
if (abs(span) > history->count) if (abs(span) > history->count)
{ {
start_index = history->start_index; start_index = history->start_index;
} }
else else
{ {
start_index = (history->start_index + history->count - abs(span)) % MAX_HISTORY_COUNT; start_index = (history->start_index + history->count - abs(span)) % MAX_HISTORY_COUNT;
} }
for (n = 0; n < history->count && n < abs(span); n++) for (n = 0; n < history->count && n < abs(span); n++)
{ {
ret = playqueuecontents_add_source(songlist, history->id[(start_index + n) % MAX_HISTORY_COUNT], (n + 1), ret = playqueuecontents_add_source(songlist, history->id[(start_index + n) % MAX_HISTORY_COUNT], (n + 1), status.plid);
status.plid); if (ret < 0)
if (ret < 0) {
{ DPRINTF(E_LOG, L_DACP, "Could not add song to songlist for playqueue-contents\n");
DPRINTF(E_LOG, L_DACP, "Could not add song to songlist for playqueue-contents\n");
dmap_send_error(req, "ceQR", "Out of memory"); dmap_send_error(req, "ceQR", "Out of memory");
return; return;
} }
} }
} }
else else
{ {
/* Fast forward to song currently being played */ /* Fast forward to song currently being played */
head = player_queue_get(); head = player_queue_get();
if (head) if (head)
{ {
ps = head; ps = head;
while ((ps->id != status.id) && (ps = next_ps(ps, status.shuffle)) && (ps != head)) while ((ps->id != status.id) && (ps = next_ps(ps, status.shuffle)) && (ps != head))
i++; i++;
while ((n < abs(span)) && (ps = next_ps(ps, status.shuffle)) && (ps != head)) while ((n < abs(span)) && (ps = next_ps(ps, status.shuffle)) && (ps != head))
{ {
n++; n++;
ret = playqueuecontents_add_source(songlist, ps->id, (n + i + 1), status.plid); ret = playqueuecontents_add_source(songlist, ps->id, (n + i + 1), status.plid);
if (ret < 0) if (ret < 0)
{ {
DPRINTF(E_LOG, L_DACP, "Could not add song to songlist for playqueue-contents\n"); DPRINTF(E_LOG, L_DACP, "Could not add song to songlist for playqueue-contents\n");
dmap_send_error(req, "ceQR", "Out of memory"); dmap_send_error(req, "ceQR", "Out of memory");
return; return;
} }
} }
} }
} }
} }
/* Playlists are hist, curr and main. */ /* Playlists are hist, curr and main. */

View File

@ -1485,18 +1485,18 @@ source_read(uint8_t *buf, int len, uint64_t rtptime)
while (nbytes < len) while (nbytes < len)
{ {
if (new) if (new)
{ {
DPRINTF(E_DBG, L_PLAYER, "New file\n"); DPRINTF(E_DBG, L_PLAYER, "New file\n");
new = 0; new = 0;
// add song to the played history // add song to the played history
history_add(cur_streaming->id); history_add(cur_streaming->id);
ret = source_next(0); ret = source_next(0);
if (ret < 0) if (ret < 0)
return -1; return -1;
} }
if (EVBUFFER_LENGTH(audio_buf) == 0) if (EVBUFFER_LENGTH(audio_buf) == 0)
{ {