jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

gcc -Wformat=2


Hi,

if you compile jed with -Wformat=2 you get some warnings, that printf
arguments aren't a string literal.

#v+
/tmp/jed-B0.99-17.56/src/ledit.c: In function `jed_vget_y_n':
/tmp/jed-B0.99-17.56/src/ledit.c:607: warning: format not a string literal, argument types not checked
/tmp/jed-B0.99-17.56/src/ledit.c: In function `jed_traceback':
/tmp/jed-B0.99-17.56/src/ledit.c:2084: warning: format not a string literal and no format arguments
#v-

Don't know, what to do in this two cases, but here is a little patch for
another case:

#v+
--- jed-B0.99-17.56/src/screen.c        2005-05-02 18:57:53.625210552 +0200
+++ jed-B0.99-17.56.old/src/screen.c    2004-11-28 22:44:05.000000000 +0100
@@ -324,6 +324,7 @@
        line = line->prev;
      }
 
+   sprintf (format, "%%%dd ", CBuf->line_num_display_size-1);
    SLsmg_set_color (JLINENUM_COLOR);
    c = JWindow->sx;
 
@@ -343,7 +344,7 @@
          }
 
        SLsmg_gotorc (i, c);
-       sprintf (buf, "%*d", CBuf->line_num_display_size-1, linenum);
+       sprintf (buf, format, linenum);
        SLsmg_write_string (buf);
 
        line = line->next;
#v-

Jörg.

-- 
"...anytime you install something new on the Windows platform, you risk
spending the next five or six hours trying to figure out what happened"
         -- Robert Roblin, Adobe

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]