aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-02 19:01:02 +0200
committerMax Kellermann <max@duempel.org>2008-10-02 19:01:02 +0200
commitee9951222c4f0e3970466f6aba2e42dea21a6cdc (patch)
treee02b7d1ae6b5078df340485e1b81861a0aab9e12 /src/screen.c
parentb693269fd9740a3074b84da5645f6bd9daa6486e (diff)
downloadmpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.tar.gz
mpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.tar.xz
mpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.zip
charset: renamed my_strlen() to utf8_width()
my_strlen() is a bad name for the function, since the return value is not a length, but a visible width on the screen. Rename it to utf8_width() and change its return type to "unsigned".
Diffstat (limited to '')
-rw-r--r--src/screen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/screen.c b/src/screen.c
index 8e6ddefde..87d738825 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -165,7 +165,7 @@ paint_top_window2(const char *header, mpdclient_t *c)
g_snprintf(buf, 32, _(" Volume %d%%"), c->status->volume);
}
colors_use(w, COLOR_TITLE);
- mvwaddstr(w, 0, screen.top_window.cols-my_strlen(buf), buf);
+ mvwaddstr(w, 0, screen.top_window.cols - utf8_width(buf), buf);
flags[0] = 0;
if (c->status != NULL) {
@@ -196,11 +196,11 @@ static void
paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
{
static int prev_volume = -1;
- static size_t prev_header_len = -1;
+ static unsigned prev_header_len = -1;
WINDOW *w = screen.top_window.w;
- if (prev_header_len!=my_strlen(header)) {
- prev_header_len = my_strlen(header);
+ if (prev_header_len != utf8_width(header)) {
+ prev_header_len = utf8_width(header);
full_repaint = 1;
}
@@ -277,7 +277,7 @@ paint_status_window(mpdclient_t *c)
if (str) {
waddstr(w, str);
- x += my_strlen(str)+1;
+ x += utf8_width(str) + 1;
}
/* create time string */
@@ -329,7 +329,7 @@ paint_status_window(mpdclient_t *c)
if (status != NULL && (IS_PLAYING(status->state) ||
IS_PAUSED(status->state))) {
char songname[MAX_SONGNAME_LENGTH];
- int width = COLS-x-my_strlen(screen.buf);
+ int width = COLS - x - utf8_width(screen.buf);
if (song)
strfsong(songname, MAX_SONGNAME_LENGTH,
@@ -339,7 +339,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) > (size_t)width) {
+ if (options.scroll && utf8_width(songname) > (unsigned)width) {
static scroll_state_t st = { 0, 0 };
char *tmp = strscroll(songname, options.scroll_sep, width, &st);