diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 2dd5e12b76ab43828fbab40f2acb66e4f1ecc991..59329694847d4fb00ef10c67441057e260fc361b 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
#include "easy_download.h"
#include "strfsong.h"
#include "src_lyrics.h"
+#include "gcc.h"
#define _GNU_SOURCE
#include <stdlib.h>
char title[512];
static char path[1024];
FILE *lyr_file;
+ unsigned i;
+ char line_buf[1024];
get_text_line(&lyr_text, 0, artist, 512);
get_text_line(&lyr_text, 1, title, 512);
if (lyr_file == NULL)
return -1;
- int i;
- char line_buf[1024];
-
for (i = 3; i <= lyr_text.text->len; i++) {
if(get_text_line(&lyr_text, i, line_buf, 1024) == -1);
fputs(line_buf, lyr_file);
{
mpd_Status *status = ((retrieval_spec*)c)->client->status;
mpd_Song *cur = ((retrieval_spec*)c)->client->song;
+ char artist[MAX_SONGNAME_LENGTH];
+ char title[MAX_SONGNAME_LENGTH];
+
//mpdclient_update((mpdclient_t*)c);
if(!(IS_PAUSED(status->state)||IS_PLAYING(status->state))) {
}
- char artist[MAX_SONGNAME_LENGTH];
- char title[MAX_SONGNAME_LENGTH];
lock=2;
result = 0;
}
static const char *
-list_callback(int index, int *highlight, void *data)
+list_callback(unsigned idx, int *highlight, mpd_unused void *data)
{
static char buf[512];
//i think i'ts fine to write it into the 1st line...
- if ((index == lyr_text.lines->len && lyr_text.lines->len > 4) ||
+ if ((idx == lyr_text.lines->len && lyr_text.lines->len > 4) ||
((lyr_text.lines->len == 0 || lyr_text.lines->len == 4) &&
- index == 0)) {
- *highlight=3;
+ idx == 0)) {
src_lyr* selected = g_array_index(src_lyr_stack, src_lyr*, src_selection);
+ *highlight=3;
if (selected != NULL)
return selected->description;
return "";
}
- if (index < 2 && lyr_text.lines->len > 4)
+ if (idx < 2 && lyr_text.lines->len > 4)
*highlight=3;
- else if(index >= lyr_text.lines->len ||
- (index < 4 && index != 0 && lyr_text.lines->len < 5)) {
+ else if(idx >= lyr_text.lines->len ||
+ (idx < 4 && idx != 0 && lyr_text.lines->len < 5)) {
return "";
}
- get_text_line(&lyr_text, index, buf, 512);
+ get_text_line(&lyr_text, idx, buf, 512);
return buf;
}
static const char *
-lyrics_title(char *str, size_t size)
+lyrics_title(mpd_unused char *str, mpd_unused size_t size)
{
static GString *msg;
if (msg == NULL)
g_string_append (msg, "Lyrics [");
- if (src_selection > src_lyr_stack->len - 1)
+ if (src_selection > (int)src_lyr_stack->len - 1)
g_string_append (msg, "No plugin available");
else {
src_lyr* selected = g_array_index (src_lyr_stack, src_lyr*, src_selection);
}
static void
-lyrics_paint(screen_t *screen, mpdclient_t *c)
+lyrics_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
lw->clear = 1;
list_window_paint(lw, list_callback, NULL);
static void
-lyrics_update(screen_t *screen, mpdclient_t *c)
+lyrics_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
if( lw->repaint ) {
list_window_paint(lw, list_callback, NULL);
lw->start = 0;
return 1;
case CMD_LIST_LAST:
- lw->start = lyrics_text_rows-lw->rows;
- if( lw->start<0 )
+ if ((unsigned)lyrics_text_rows > lw->rows)
+ lw->start = lyrics_text_rows - lw->rows;
+ else
lw->start = 0;
return 1;
case CMD_LIST_NEXT_PAGE:
- lw->start = lw->start + lw->rows-1;
- if( lw->start+lw->rows >= lyr_text.lines->len+1 )
- lw->start = lyr_text.lines->len-lw->rows+1;
- if( lw->start<0 )
- lw->start = 0;
+ lw->start = lw->start + lw->rows - 1;
+ if (lw->start + lw->rows >= (unsigned)lyrics_text_rows + 1) {
+ if ((unsigned)lyrics_text_rows + 1 > lw->rows)
+ lw->start = lyrics_text_rows + 1 - lw->rows;
+ else
+ lw->start = 0;
+ }
return 1;
case CMD_LIST_PREVIOUS_PAGE:
- lw->start = lw->start - lw->rows;
- if( lw->start<0 )
+ if (lw->start > lw->rows)
+ lw->start -= lw->rows;
+ else
lw->start = 0;
return 1;
case CMD_SELECT:
return 1;
case CMD_SEARCH_MODE:
//while (0==0) fprintf (stderr, "%i", src_lyr_stack->len);
- if (src_selection == src_lyr_stack->len - 1)
+ if (src_selection == (int)src_lyr_stack->len - 1)
src_selection = -1;
src_selection++;
return 1;
cmd, list_callback, NULL)) {
/* center the row */
lw->start = lw->selected - (lw->rows / 2);
- if (lw->start + lw->rows > lyrics_text_rows)
- lw->start = lyrics_text_rows - lw->rows;
- if (lw->start < 0)
- lw->start = 0;
+ if (lw->start + lw->rows > (unsigned)lyrics_text_rows) {
+ if (lw->rows < (unsigned)lyrics_text_rows)
+ lw->start = lyrics_text_rows - lw->rows;
+ else
+ lw->start = 0;
+ }
return 1;
}