aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-15 13:27:30 +0200
committerMax Kellermann <max@duempel.org>2008-09-15 13:27:30 +0200
commite7981e0e28541e5046c40879a4fdbcc308f143ec (patch)
tree86a4fe788f692321e6a6fbaff8d83708ba764234 /src
parent6e81a1b3e08a423c6f4c6976aecae915bd1a3f0b (diff)
downloadmpd-e7981e0e28541e5046c40879a4fdbcc308f143ec.tar.gz
mpd-e7981e0e28541e5046c40879a4fdbcc308f143ec.tar.xz
mpd-e7981e0e28541e5046c40879a4fdbcc308f143ec.zip
use size_t and unsigned integers
Diffstat (limited to 'src')
-rw-r--r--src/conf.c11
-rw-r--r--src/list_window.c54
-rw-r--r--src/list_window.h28
-rw-r--r--src/mpdclient.c6
-rw-r--r--src/options.c2
-rw-r--r--src/screen.c6
-rw-r--r--src/screen_browse.h2
-rw-r--r--src/screen_file.c4
-rw-r--r--src/screen_help.c41
-rw-r--r--src/screen_keydef.c14
-rw-r--r--src/screen_lyrics.c40
-rw-r--r--src/screen_play.c19
-rw-r--r--src/screen_search.c4
-rw-r--r--src/src_lyrics.c2
-rw-r--r--src/src_lyrics.h2
-rw-r--r--src/support.c2
-rw-r--r--src/support.h2
-rw-r--r--src/wreadln.c5
18 files changed, 130 insertions, 114 deletions
diff --git a/src/conf.c b/src/conf.c
index 5792dd22f..b49eeb244 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -94,7 +94,8 @@ str2bool(char *str)
static int
parse_key_value(char *str, size_t len, char **end)
{
- int i, value;
+ size_t i;
+ int value;
key_parser_state_t state;
i=0;
@@ -164,8 +165,8 @@ parse_key_definition(char *str)
{
char buf[MAX_LINE_LENGTH];
char *p, *end;
- size_t len = strlen(str);
- int i,j,key;
+ size_t len = strlen(str), i;
+ int j,key;
int keys[MAX_COMMAND_KEYS];
command_t cmd;
@@ -256,8 +257,8 @@ parse_color_definition(char *str)
{
char buf[MAX_LINE_LENGTH];
char *p, *end, *name;
- size_t len = strlen(str);
- int i,j,value;
+ size_t len = strlen(str), i;
+ int j,value;
short color, rgb[3];
/* get the command name */
diff --git a/src/list_window.c b/src/list_window.c
index 859652c1d..af8abc9d4 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -32,7 +32,7 @@
extern void screen_bell(void);
list_window_t *
-list_window_init(WINDOW *w, int width, int height)
+list_window_init(WINDOW *w, unsigned width, unsigned height)
{
list_window_t *lw;
@@ -65,14 +65,11 @@ list_window_reset(list_window_t *lw)
}
void
-list_window_check_selected(list_window_t *lw, int length)
+list_window_check_selected(list_window_t *lw, unsigned length)
{
- while (lw->start && lw->start + lw->rows > length)
+ while (lw->start > 0 && lw->start + lw->rows > length)
lw->start--;
- if (lw->selected < 0)
- lw->selected = 0;
-
while (lw->selected < lw->start)
lw->selected++;
@@ -81,22 +78,22 @@ list_window_check_selected(list_window_t *lw, int length)
}
void
-list_window_set_selected(list_window_t *lw, int n)
+list_window_set_selected(list_window_t *lw, unsigned n)
{
lw->selected = n;
}
void
-list_window_next(list_window_t *lw, int length)
+list_window_next(list_window_t *lw, unsigned length)
{
- if (lw->selected < length - 1)
+ if (lw->selected + 1 < length)
lw->selected++;
else if (options.list_wrap)
lw->selected = 0;
}
void
-list_window_previous(list_window_t *lw, int length)
+list_window_previous(list_window_t *lw, unsigned length)
{
if (lw->selected > 0)
lw->selected--;
@@ -112,20 +109,22 @@ list_window_first(list_window_t *lw)
}
void
-list_window_last(list_window_t *lw, int length)
+list_window_last(list_window_t *lw, unsigned length)
{
lw->xoffset = 0;
- lw->selected = length - 1;
+ if (length > 0)
+ lw->selected = length - 1;
+ else
+ lw->selected = 0;
}
void
-list_window_next_page(list_window_t *lw, int length)
+list_window_next_page(list_window_t *lw, unsigned length)
{
- int step = lw->rows - 1;
- if (step <= 0)
+ if (lw->rows < 2)
return;
- if (lw->selected + step < length - 1)
- lw->selected += step;
+ if (lw->selected + lw->rows < length)
+ lw->selected += lw->rows - 1;
else
return list_window_last(lw, length);
}
@@ -133,11 +132,10 @@ list_window_next_page(list_window_t *lw, int length)
void
list_window_previous_page(list_window_t *lw)
{
- int step = lw->rows - 1;
- if (step <= 0)
+ if (lw->rows < 2)
return;
- if (lw->selected-step > 0)
- lw->selected -= step;
+ if (lw->selected > lw->rows - 1)
+ lw->selected -= lw->rows - 1;
else
list_window_first(lw);
}
@@ -148,7 +146,7 @@ list_window_paint(list_window_t *lw,
list_window_callback_fn_t callback,
void *callback_data)
{
- int i;
+ unsigned i;
int fill = options.wide_cursor;
int show_cursor = !(lw->flags & LW_HIDE_CURSOR);
@@ -206,7 +204,7 @@ list_window_find(list_window_t *lw,
int wrap)
{
int h;
- int i = lw->selected + 1;
+ unsigned i = lw->selected + 1;
const char *label;
while (wrap || i == lw->selected + 1) {
@@ -236,22 +234,22 @@ list_window_rfind(list_window_t *lw,
void *callback_data,
const char *str,
int wrap,
- int rows)
+ unsigned rows)
{
int h;
- int i = lw->selected-1;
+ int i = lw->selected - 1;
const char *label;
if (rows == 0)
return 1;
- while (wrap || i == lw->selected - 1) {
+ while (wrap || i == (int)lw->selected - 1) {
while (i >= 0 && (label = callback(i,&h,callback_data))) {
if( str && label && strcasestr(label, str) ) {
lw->selected = i;
return 0;
}
- if (wrap && i == lw->selected)
+ if (wrap && i == (int)lw->selected)
return 1;
i--;
}
@@ -265,7 +263,7 @@ list_window_rfind(list_window_t *lw,
/* perform basic list window commands (movement) */
int
-list_window_cmd(list_window_t *lw, int rows, command_t cmd)
+list_window_cmd(list_window_t *lw, unsigned rows, command_t cmd)
{
switch (cmd) {
case CMD_LIST_PREVIOUS:
diff --git a/src/list_window.h b/src/list_window.h
index ad66760bb..2fadeebd1 100644
--- a/src/list_window.h
+++ b/src/list_window.h
@@ -10,17 +10,17 @@
#define LW_HIDE_CURSOR 0x01
-typedef const char *(*list_window_callback_fn_t)(int index,
+typedef const char *(*list_window_callback_fn_t)(unsigned index,
int *highlight,
void *data);
typedef struct {
WINDOW *w;
- int rows, cols;
+ unsigned rows, cols;
- int start;
- int selected;
- int xoffset;
+ unsigned start;
+ unsigned selected;
+ unsigned xoffset;
int clear;
int repaint;
int flags;
@@ -32,7 +32,7 @@ typedef struct {
/* create a new list window */
-list_window_t *list_window_init(WINDOW *w, int width, int height);
+list_window_t *list_window_init(WINDOW *w, unsigned width, unsigned height);
/* destroy a list window (returns NULL) */
list_window_t *list_window_free(list_window_t *lw);
@@ -46,18 +46,18 @@ void list_window_paint(list_window_t *lw,
void *callback_data);
/* perform basic list window commands (movement) */
-int list_window_cmd(list_window_t *lw, int rows, command_t cmd);
+int list_window_cmd(list_window_t *lw, unsigned rows, command_t cmd);
/* select functions */
-void list_window_set_selected(list_window_t *lw, int n);
-void list_window_previous(list_window_t *lw, int length);
-void list_window_next(list_window_t *lw, int length);
+void list_window_set_selected(list_window_t *lw, unsigned n);
+void list_window_previous(list_window_t *lw, unsigned length);
+void list_window_next(list_window_t *lw, unsigned length);
void list_window_first(list_window_t *lw);
-void list_window_last(list_window_t *lw, int length);
+void list_window_last(list_window_t *lw, unsigned length);
void list_window_previous_page(list_window_t *lw);
-void list_window_next_page(list_window_t *lw, int length);
-void list_window_check_selected(list_window_t *lw, int length);
+void list_window_next_page(list_window_t *lw, unsigned length);
+void list_window_check_selected(list_window_t *lw, unsigned length);
/* find a string in a list window */
int list_window_find(list_window_t *lw,
@@ -73,7 +73,7 @@ list_window_rfind(list_window_t *lw,
void *callback_data,
const char *str,
int wrap,
- int rows);
+ unsigned rows);
/* list window states */
list_window_state_t *list_window_init_state(void);
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 0533cad95..57b470681 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -490,7 +490,7 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
mpd_Song *song1, *song2;
if (old_index == new_index || new_index < 0 ||
- new_index >= c->playlist.length)
+ (guint)new_index >= c->playlist.length)
return -1;
song1 = playlist_get_song(c, old_index);
@@ -739,7 +739,7 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
while ((entity = mpd_getNextInfoEntity(c->connection)) != NULL) {
mpd_Song *song = entity->info.song;
- if (song->pos < c->playlist.length) {
+ if (song->pos >= 0 && (guint)song->pos < c->playlist.length) {
GList *item = g_list_nth(c->playlist.list, song->pos);
/* update song */
@@ -756,7 +756,7 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
}
/* remove trailing songs */
- while (c->status->playlistLength < c->playlist.length) {
+ while ((guint)c->status->playlistLength < c->playlist.length) {
GList *item = g_list_last(c->playlist.list);
/* Remove the last playlist entry */
diff --git a/src/options.c b/src/options.c
index 9b1aafe4f..7426a55ca 100644
--- a/src/options.c
+++ b/src/options.c
@@ -275,7 +275,7 @@ options_parse(int argc, const char *argv[])
}
/* check for short options */
else if (len>=2 && g_str_has_prefix(arg, "-")) {
- int j;
+ size_t j;
for(j=1; j<len; j++) {
/* make shure we got an argument for the previous option */
diff --git a/src/screen.c b/src/screen.c
index d952a1fe4..3db9730e8 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -258,7 +258,7 @@ static void
paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
{
static int prev_volume = -1;
- static int prev_header_len = -1;
+ static size_t prev_header_len = -1;
WINDOW *w = screen->top_window.w;
if (prev_header_len!=my_strlen(header)) {
@@ -385,7 +385,7 @@ paint_status_window(mpdclient_t *c)
colors_use(w, COLOR_STATUS);
/* scroll if the song name is to long */
- if (options.scroll && my_strlen(songname) > width) {
+ if (options.scroll && my_strlen(songname) > (size_t)width) {
static scroll_state_t st = { 0, 0 };
char *tmp = strscroll(songname, options.scroll_sep, width, &st);
@@ -809,7 +809,7 @@ screen_get_mouse_event(mpdclient_t *c,
}
/* if the even occured below the list window move down */
- if (*row >= lw->rows && lw) {
+ if ((unsigned)*row >= lw->rows && lw) {
if (event.bstate & BUTTON3_CLICKED)
list_window_last(lw, lw_length);
else
diff --git a/src/screen_browse.h b/src/screen_browse.h
index c58867500..0726d0b35 100644
--- a/src/screen_browse.h
+++ b/src/screen_browse.h
@@ -6,7 +6,7 @@ void set_highlight(mpdclient_filelist_t *filelist,
int highlight);
-const char *browse_lw_callback(int index, int *highlight, void *filelist);
+const char *browse_lw_callback(unsigned index, int *highlight, void *filelist);
int browse_handle_select(screen_t *screen,
mpdclient_t *c,
diff --git a/src/screen_file.c b/src/screen_file.c
index ab2af0713..c00ccba44 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -147,7 +147,7 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
/* list_window callback */
const char *
-browse_lw_callback(int idx, int *highlight, void *data)
+browse_lw_callback(unsigned idx, int *highlight, void *data)
{
static char buf[BUFSIZE];
mpdclient_filelist_t *fl = (mpdclient_filelist_t *) data;
@@ -645,7 +645,7 @@ browse_handle_mouse_event(screen_t *screen,
mpdclient_filelist_t *fl)
{
int row;
- int prev_selected = local_lw->selected;
+ unsigned prev_selected = local_lw->selected;
unsigned long bstate;
int length;
diff --git a/src/screen_help.c b/src/screen_help.c
index 2b5dc1f16..681bc6cfe 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -147,7 +147,7 @@ static list_window_t *lw = NULL;
static const char *
-list_callback(int idx, int *highlight, void *data)
+list_callback(unsigned idx, int *highlight, void *data)
{
static char buf[512];
@@ -158,7 +158,7 @@ list_callback(int idx, int *highlight, void *data)
}
*highlight = 0;
- if (idx < help_text_rows) {
+ if (idx < (unsigned)help_text_rows) {
*highlight = help_text[idx].highlight > 0;
if (help_text[idx].command == CMD_NONE) {
if (help_text[idx].text)
@@ -166,7 +166,7 @@ list_callback(int idx, int *highlight, void *data)
else if (help_text[idx].highlight == 2) {
int i;
- for (i = 3; i < COLS - 3 && i < sizeof(buf); i++)
+ for (i = 3; i < COLS - 3 && i < (int)sizeof(buf); i++)
buf[i] = '-';
buf[i] = '\0';
} else
@@ -243,7 +243,7 @@ help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
lw->clear=1;
switch(cmd) {
case CMD_LIST_NEXT:
- if (lw->start + lw->rows < help_text_rows)
+ if (lw->start + lw->rows < (unsigned)help_text_rows)
lw->start++;
return 1;
case CMD_LIST_PREVIOUS:
@@ -254,20 +254,24 @@ help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
lw->start = 0;
return 1;
case CMD_LIST_LAST:
- lw->start = help_text_rows - lw->rows;
- if (lw->start < 0)
+ if ((unsigned)help_text_rows > lw->rows)
+ lw->start = help_text_rows - lw->rows;
+ else
lw->start = 0;
return 1;
case CMD_LIST_NEXT_PAGE:
lw->start = lw->start + lw->rows;
- if (lw->start + lw->rows >= help_text_rows)
- lw->start = help_text_rows - lw->rows;
- if (lw->start < 0)
- lw->start = 0;
+ if (lw->start + lw->rows >= (unsigned)help_text_rows) {
+ if ((unsigned)help_text_rows > lw->rows)
+ lw->start = help_text_rows - 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;
default:
@@ -279,11 +283,16 @@ help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
lw, help_text_rows,
cmd, list_callback, NULL)) {
/* center the row */
- lw->start = lw->selected - (lw->rows / 2);
- if (lw->start + lw->rows > help_text_rows)
- lw->start = help_text_rows - lw->rows;
- if (lw->start < 0)
+ if (lw->selected > lw->rows / 2)
+ lw->start = lw->selected - lw->rows / 2;
+ else
lw->start = 0;
+ if (lw->start + lw->rows > (unsigned)help_text_rows) {
+ if (lw->rows < (unsigned)help_text_rows)
+ lw->start = help_text_rows - lw->rows;
+ else
+ lw->start = 0;
+ }
return 1;
}
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index bc37f1af3..54a234961 100644
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
@@ -39,7 +39,7 @@
#define STATIC_SUB_ITEMS 1
#define BUFSIZE 256
-#define LIST_ITEM_APPLY() (command_list_length)
+#define LIST_ITEM_APPLY() ((unsigned)command_list_length)
#define LIST_ITEM_SAVE() (LIST_ITEM_APPLY()+1)
#define LIST_LENGTH() (LIST_ITEM_SAVE()+1)
@@ -48,12 +48,12 @@
static list_window_t *lw = NULL;
-static int command_list_length = 0;
+static unsigned command_list_length = 0;
static command_definition_t *cmds = NULL;
static int subcmd = -1;
-static int subcmd_length = 0;
-static int subcmd_addpos = 0;
+static unsigned subcmd_length = 0;
+static unsigned subcmd_addpos = 0;
static int
keybindings_changed(void)
@@ -183,13 +183,13 @@ assign_new_key(WINDOW *w, int cmd_index, int key_index)
}
static const char *
-list_callback(int idx, int *highlight, void *data)
+list_callback(unsigned idx, int *highlight, void *data)
{
static char buf[BUFSIZE];
*highlight = 0;
if (subcmd < 0) {
- if (idx < command_list_length) {
+ if (idx < (unsigned)command_list_length) {
if (cmds[idx].flags & COMMAND_KEY_CONFLICT)
*highlight = 1;
return cmds[idx].name;
@@ -338,7 +338,7 @@ keydef_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
lw->clear = 1;
return 1;
case CMD_DELETE:
- if (subcmd >= 0 && lw->selected - STATIC_SUB_ITEMS >= 0)
+ if (subcmd >= 0 && lw->selected >= STATIC_SUB_ITEMS)
delete_key(subcmd, lw->selected - STATIC_SUB_ITEMS);
return 1;
break;
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 2c770ff59..fb45fd49d 100644
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
@@ -71,7 +71,7 @@ static int store_lyr_hd(void)
char title[512];
static char path[1024];
FILE *lyr_file;
- int i;
+ unsigned i;
char line_buf[1024];
get_text_line(&lyr_text, 0, artist, 512);
@@ -152,7 +152,7 @@ static gpointer get_lyr(void *c)
}
static const char *
-list_callback(int idx, int *highlight, void *data)
+list_callback(unsigned idx, int *highlight, void *data)
{
static char buf[512];
@@ -214,7 +214,7 @@ lyrics_title(char *str, size_t size)
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);
@@ -282,20 +282,24 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
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:
@@ -319,7 +323,7 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
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;
@@ -333,10 +337,12 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
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;
}
diff --git a/src/screen_play.c b/src/screen_play.c
index a1bb369e6..6b68568ee 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -73,7 +73,7 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
}
static const char *
-list_callback(int idx, int *highlight, void *data)
+list_callback(unsigned idx, int *highlight, void *data)
{
static char songname[MAX_SONG_LENGTH];
mpdclient_t *c = (mpdclient_t *) data;
@@ -94,8 +94,8 @@ list_callback(int idx, int *highlight, void *data)
static int
center_playing_item(screen_t *screen, mpdclient_t *c)
{
- int length = c->playlist.length;
- int offset = lw->selected - lw->start;
+ unsigned length = c->playlist.length;
+ unsigned offset = lw->selected - lw->start;
int idx;
if (!lw || !c->song || length<lw->rows ||
@@ -105,11 +105,12 @@ center_playing_item(screen_t *screen, mpdclient_t *c)
/* try to center the song that are playing */
idx = playlist_get_index(c, c->song);
D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,idx);
- lw->start = idx - (lw->rows / 2);
- if (lw->start + lw->rows > length)
- lw->start = length - lw->rows;
- if (lw->start < 0)
- lw->start = 0;
+ idx -= (lw->rows / 2);
+ if (idx + (int)lw->rows > (int)length)
+ idx = length - lw->rows;
+ if (idx < 0)
+ idx = 0;
+ lw->start = idx;
/* make sure the cursor is in the window */
lw->selected = lw->start+offset;
@@ -419,7 +420,7 @@ static int
handle_mouse_event(screen_t *screen, mpdclient_t *c)
{
int row;
- int selected;
+ unsigned selected;
unsigned long bstate;
if (screen_get_mouse_event(c, lw, c->playlist.length, &bstate, &row))
diff --git a/src/screen_search.c b/src/screen_search.c
index dd2353c00..2161b7914 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -116,9 +116,9 @@ static gboolean advanced_search_mode = FALSE;
/* search info */
static const char *
-lw_search_help_callback(int idx, int *highlight, void *data)
+lw_search_help_callback(unsigned idx, int *highlight, void *data)
{
- int text_rows;
+ unsigned text_rows;
static const char *text[] = {
"Quick - just enter a string and ncmpc will search according",
" to the current search mode (displayed above).",
diff --git a/src/src_lyrics.c b/src/src_lyrics.c
index 448c301ad..6ac6cc3c5 100644
--- a/src/src_lyrics.c
+++ b/src/src_lyrics.c
@@ -26,7 +26,7 @@
#define PLUGIN_DIR_USER "/.ncmpc/plugins"
-int get_text_line(formed_text *text, int num, char *dest, int len)
+int get_text_line(formed_text *text, unsigned num, char *dest, size_t len)
{
int linelen;
diff --git a/src/src_lyrics.h b/src/src_lyrics.h
index 941c4b63a..b972e7af5 100644
--- a/src/src_lyrics.h
+++ b/src/src_lyrics.h
@@ -71,7 +71,7 @@ typedef int (*src_lyr_plugin_register) (src_lyr *source_descriptor);
GArray *src_lyr_stack;
-int get_text_line(formed_text *text, int num, char *dest, int len);
+int get_text_line(formed_text *text, unsigned num, char *dest, size_t len);
void src_lyr_stack_init(void);
int src_lyr_init(void);
diff --git a/src/support.c b/src/support.c
index 315c569f7..ae3381ef2 100644
--- a/src/support.c
+++ b/src/support.c
@@ -137,7 +137,7 @@ strscroll(char *str, char *separator, int width, scroll_state_t *st)
} else {
buf = g_malloc(size);
g_strlcpy(buf, tmp+st->offset, size);
- if (strlen(buf) < width)
+ if (strlen(buf) < (size_t)width)
g_strlcat(buf, tmp, size);
}
if( time(NULL)-st->t >= 1 ) {
diff --git a/src/support.h b/src/support.h
index 8e868e7ff..b80b9c8a2 100644
--- a/src/support.h
+++ b/src/support.h
@@ -18,7 +18,7 @@ char *lowerstr(char *str);
char *strcasestr(const char *haystack, const char *needle);
typedef struct {
- int offset;
+ gsize offset;
GTime t; /* GTime is equivalent to time_t */
} scroll_state_t;
diff --git a/src/wreadln.c b/src/wreadln.c
index e6bc61237..ed8ad9a39 100644
--- a/src/wreadln.c
+++ b/src/wreadln.c
@@ -66,7 +66,8 @@ static inline void cursor_move_right(gint *cursor,
gint x1,
gchar *line)
{
- if (*cursor < strlen(line) && *cursor < wrln_max_line_size - 1) {
+ if (*cursor < (int)strlen(line) &&
+ *cursor < (int)wrln_max_line_size - 1) {
(*cursor)++;
if (*cursor + x0 >= x1 && *start < *cursor - width + 1)
(*start)++;
@@ -284,7 +285,7 @@ _wreadln(WINDOW *w,
break;
case KEY_DC: /* handle delete key. As above */
case KEY_CTRL_D:
- if (cursor <= my_strlen(line) - 1) {
+ if (cursor <= (gint)my_strlen(line) - 1) {
for (i = cursor; line[i] != 0; i++)
line[i] = line[i + 1];
}