Cast second arg to iconv to remove warning
[tig] / tig.c
diff --git a/tig.c b/tig.c
index 6c2b7d0..fcfbc43 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -730,9 +730,6 @@ static struct keybinding default_keybindings[] = {
        { 'g',          REQ_TOGGLE_REV_GRAPH },
        { ':',          REQ_PROMPT },
 
-       /* wgetch() with nodelay() enabled returns ERR when there's no input. */
-       { ERR,          REQ_NONE },
-
        /* Using the ncurses SIGWINCH handler. */
        { KEY_RESIZE,   REQ_SCREEN_RESIZE },
 };
@@ -1877,7 +1874,7 @@ update_view(struct view *view)
 
                        size_t ret;
 
-                       ret = iconv(opt_iconv, &inbuf, &inlen, &outbuf, &outlen);
+                       ret = iconv(opt_iconv, (const char **) &inbuf, &inlen, &outbuf, &outlen);
                        if (ret != (size_t) -1) {
                                line = out_buffer;
                                linelen = strlen(out_buffer);
@@ -2686,7 +2683,7 @@ static struct view_ops blob_ops = {
 
 struct commit {
        char id[SIZEOF_REV];            /* SHA1 ID. */
-       char title[75];                 /* First line of the commit message. */
+       char title[128];                /* First line of the commit message. */
        char author[75];                /* Author of the commit. */
        struct tm time;                 /* Date from the author ident. */
        struct ref **refs;              /* Repository references. */
@@ -2890,13 +2887,19 @@ main_read(struct view *view, char *line)
 
                /* Require titles to start with a non-space character at the
                 * offset used by git log. */
-               /* FIXME: More gracefull handling of titles; append "..." to
-                * shortened titles, etc. */
-               if (strncmp(line, "    ", 4) ||
-                   isspace(line[4]))
+               if (strncmp(line, "    ", 4))
                        break;
+               line += 4;
+               /* Well, if the title starts with a whitespace character,
+                * try to be forgiving.  Otherwise we end up with no title. */
+               while (isspace(*line))
+                       line++;
+               if (*line == '\0')
+                       break;
+               /* FIXME: More graceful handling of titles; append "..." to
+                * shortened titles, etc. */
 
-               string_copy(commit->title, line + 4);
+               string_copy(commit->title, line);
        }
 
        return TRUE;
@@ -3531,8 +3534,13 @@ main(int argc, char *argv[])
 
                /* Refresh, accept single keystroke of input */
                key = wgetch(status_win);
-               if (key == ERR)
+
+               /* wgetch() with nodelay() enabled returns ERR when there's no
+                * input. */
+               if (key == ERR) {
+                       request = REQ_NONE;
                        continue;
+               }
 
                request = get_keybinding(display[current_view]->keymap, key);