nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] eliminate warnings in help.c


From: Eitan Adler
Subject: [Nano-devel] eliminate warnings in help.c
Date: Sun, 23 May 2010 16:03:14 +0300

Here is a simple patch which eliminates the warnings in help.c when
run with -Wall -Wextra -ansi -pedantic

Index: global.c
===================================================================
--- global.c    (revision 4505)
+++ global.c    (working copy)
@@ -64,7 +64,7 @@
 WINDOW *bottomwin;
        /* The bottom portion of the window, where we display statusbar
         * messages, the statusbar prompt, and a list of shortcuts. */
-int editwinrows = 0;
+size_t editwinrows = 0;
        /* How many rows does the edit window take up? */
 int maxrows = 0;
        /* How many usable lines are there (due to soft wrapping) */
Index: proto.h
===================================================================
--- proto.h     (revision 4505)
+++ proto.h     (working copy)
@@ -45,7 +45,7 @@
 extern WINDOW *topwin;
 extern WINDOW *edit;
 extern WINDOW *bottomwin;
-extern int editwinrows;
+extern size_t editwinrows;
 extern int maxrows;

 extern filestruct *cutbuffer;
Index: help.c
===================================================================
--- help.c      (revision 4505)
+++ help.c      (working copy)
@@ -115,7 +115,9 @@
            for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
                size_t j = help_line_len(ptr);

-               mvwaddnstr(edit, i, 0, ptr, j);
+               const int ret = mvwaddnstr(edit, i, 0, ptr, j);
+               (void)ret;
+               assert(ret == OK);
                ptr += j;
                if (*ptr == '\n')
                    ptr++;
@@ -524,8 +526,7 @@
 /* Calculate the next line of help_text, starting at ptr. */
 size_t help_line_len(const char *ptr)
 {
-    int help_cols = (COLS > 24) ? COLS - 1 : 24;
-
+    size_t help_cols = (COLS > 24) ? COLS - 1 : 24;
     /* Try to break the line at (COLS - 1) columns if we have more than
      * 24 columns, and at 24 columns otherwise. */
     ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]