about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-26 00:36:36 +0100
committerJames Booth <boothj5@gmail.com>2014-04-26 00:36:36 +0100
commitd6e92f62dc907d5da66f477884a4c0c728b84127 (patch)
treee77d8ad400874baa5edd7dde9ce66b1847fd89e9 /src/ui
parentab4ea80a70803d8d6335d8f5a8a4248e6d5423a4 (diff)
downloadprofani-tty-d6e92f62dc907d5da66f477884a4c0c728b84127.tar.gz
Fixed cppcheck warnings
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c3
-rw-r--r--src/ui/core.c3
-rw-r--r--src/ui/inputwin.c8
-rw-r--r--src/ui/window.c1
4 files changed, 6 insertions, 9 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index d7bb1904..2aff43a5 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -643,7 +643,6 @@ static void
 _cons_show_bookmarks(const GList *list)
 {
     ProfWin *console = wins_get_console();
-    Bookmark *item;
 
     if (list == NULL) {
         cons_show("");
@@ -654,7 +653,7 @@ _cons_show_bookmarks(const GList *list)
 
         /* TODO: show status (connected or not) and window number */
         while (list != NULL) {
-            item = list->data;
+            Bookmark *item = list->data;
 
             win_print_time(console, '-');
             wprintw(console->win, "  %s", item->jid);
diff --git a/src/ui/core.c b/src/ui/core.c
index 35865ebb..adebdadd 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1050,8 +1050,6 @@ _ui_current_page_off(void)
 static void
 _ui_print_system_msg_from_recipient(const char * const from, const char *message)
 {
-    int num = 0;
-
     if (from == NULL || message == NULL)
         return;
 
@@ -1059,6 +1057,7 @@ _ui_print_system_msg_from_recipient(const char * const from, const char *message
 
     ProfWin *window = wins_get_by_recipient(jid->barejid);
     if (window == NULL) {
+        int num = 0;
         window = wins_new(jid->barejid, WIN_CHAT);
         if (window != NULL) {
             num = wins_get_num(window);
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index d528fd49..aa587594 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -109,8 +109,6 @@ inp_block(void)
 wint_t
 inp_get_char(char *input, int *size)
 {
-    int inp_x = 0;
-    int i;
     wint_t ch;
     int display_size = 0;
 
@@ -148,7 +146,7 @@ inp_get_char(char *input, int *size)
                 return ERR;
             }
 
-            inp_x = getcurx(inp_win);
+            int inp_x = getcurx(inp_win);
 
             // handle insert if not at end of input
             if (inp_x < display_size) {
@@ -160,6 +158,7 @@ inp_get_char(char *input, int *size)
                 for (offset = &input[*size - 1]; offset >= next_ch; offset--) {
                     *(offset + utf_len) = *offset;
                 }
+                int i;
                 for (i = 0; i < utf_len; i++) {
                      *(next_ch + i) = bytes[i];
                 }
@@ -181,6 +180,7 @@ inp_get_char(char *input, int *size)
 
                 // wcrtomb can return (size_t) -1
                 if (utf_len < MB_CUR_MAX) {
+                    int i;
                     for (i = 0 ; i < utf_len; i++) {
                         input[(*size)++] = bytes[i];
                     }
@@ -709,4 +709,4 @@ _printable(const wint_t ch)
     bytes[utf_len] = '\0';
     gunichar unichar = g_utf8_get_char(bytes);
     return g_unichar_isprint(unichar) && (ch != KEY_MOUSE);
-}
\ No newline at end of file
+}
diff --git a/src/ui/window.c b/src/ui/window.c
index 63d83600..7237599a 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -64,7 +64,6 @@ win_free(ProfWin* window)
     delwin(window->win);
     free(window->from);
     free(window);
-    window = NULL;
 }
 
 void