-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

While reviewing the source, I found a number of problems which are not
addressed by Andreas' patch.

1) -Wformat-non-literal is replaced by -Wformat-nonliteral, so
   replacing, rather than removing, this flag may be more
   appropriate.
2) Most of the sources only include the Standard headers if building
   with MicroSoft Visual C version 6.  The following patch makes it
   use these headers when building with any ANSI compiler, by
   checking if __STDC__ is defined.  This corrects a huge number of
   compiler warnings.
3) There are a number of other warnings about comments within
   comments, unused variables, not using parentheses around
   assignment of truth values in conditionals.  I have fixed most of
   these.
4) There are many warnings about uninitialised variables being used
   all over the place.  These should be investigated.

The patch includes a changelog entry for NMU, which may be safely
removed.  I will NMU with just the header (__STDC__) fixes and the
debian/rules compiler flag fix within the week, unless it's fixed
sooner.  I suggest sending the other fixes upstream, as well as
applying the patch for Debian.


Regards,
Roger

$ diffstat abcmidi-stdc.diff
 crack.c          |    7 ++++++-
 debian/changelog |   10 ++++++++++
 debian/rules     |    4 ++--
 debug.c          |    1 -
 drawtune.c       |    2 +-
 genmidi.c        |    2 +-
 mftext.c         |    3 ++-
 midi2abc.c       |   14 +++++++-------
 midicopy.c       |   11 ++++++++++-
 midifile.c       |   19 +++++++++++++++++--
 midifile.h       |   16 ----------------
 parseabc.c       |    4 ++--
 position.c       |    2 +-
 pslib.c          |    2 +-
 store.c          |    5 ++---
 toabc.c          |    5 ++---
 yapstree.c       |    2 +-
 17 files changed, 65 insertions(+), 44 deletions(-)

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFC0Q7/VcFcaSW/uEgRAgXvAKC11SmPB/osWXVE9TpTpKMj45q2bQCghLJH
bxCuwbLgTMeRDRKPoOjG+uA=
=P27G
-----END PGP SIGNATURE-----
diff -urN abcmidi-20050101.original/crack.c abcmidi-20050101/crack.c
--- abcmidi-20050101.original/crack.c	2000-07-30 06:49:36.000000000 +0100
+++ abcmidi-20050101/crack.c	2005-07-10 12:53:37.738661336 +0100
@@ -63,6 +63,11 @@
  */
 
 #include <stdio.h>
+#include <string.h>
+
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
 
 /* define USE_INDEX if your C libraries have index() instead of strchr() */
 #ifdef USE_INDEX
@@ -76,7 +81,7 @@
 char* crack(argc, argv, flags, ign)
     int argc; char **argv; char *flags; int ign;
 {
-    char *pv, *flgp, *strchr();
+    char *pv, *flgp;
     while ((arg_index) < argc)
 	{
 	if (pvcon != NULL)
diff -urN abcmidi-20050101.original/debian/changelog abcmidi-20050101/debian/changelog
--- abcmidi-20050101.original/debian/changelog	2005-07-10 12:20:07.000000000 +0100
+++ abcmidi-20050101/debian/changelog	2005-07-10 12:24:22.135553576 +0100
@@ -1,3 +1,13 @@
+abcmidi (20050101-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Replace the -Wformat-non-literal argument from CFLAGS in
+    debian/rules, which is not supported by GCC 4.0, with
+    -Wformat-nonliteral (Closes: #288770).  Reported by
+    Andreas Jochens.
+
+ -- Roger Leigh <[EMAIL PROTECTED]>  Sun, 10 Jul 2005 12:23:47 +0100
+
 abcmidi (20050101-1) unstable; urgency=low
 
   * New upstream release
diff -urN abcmidi-20050101.original/debian/rules abcmidi-20050101/debian/rules
--- abcmidi-20050101.original/debian/rules	2005-07-10 12:20:07.000000000 +0100
+++ abcmidi-20050101/debian/rules	2005-07-10 12:23:43.108486592 +0100
@@ -13,9 +13,9 @@
 
 # This is K&R C, so don't worry about a couple of classes of warnings.
 ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-CFLAGS="-O2 -Wall -Wno-implicit -Wno-return-type -Wformat-non-literal -c"
+CFLAGS="-O2 -Wall -Wno-implicit -Wno-return-type -Wformat-nonliteral -c"
 else
-CFLAGS="-O2 -g -Wall -Wno-implicit -Wno-return-type -Wformat-non-literal -c"
+CFLAGS="-O2 -g -Wall -Wno-implicit -Wno-return-type -Wformat-nonliteral -c"
 endif
 
 build: build-stamp
diff -urN abcmidi-20050101.original/debug.c abcmidi-20050101/debug.c
--- abcmidi-20050101.original/debug.c	2004-11-21 13:09:28.000000000 +0000
+++ abcmidi-20050101/debug.c	2005-07-10 12:54:16.751730448 +0100
@@ -203,7 +203,6 @@
   char* atitle;
   int notesdone;
   struct voice* thisvoice;
-  int doneline;
 
   notesdone = 0;
   atitle = firstitem(&t->title);
diff -urN abcmidi-20050101.original/drawtune.c abcmidi-20050101/drawtune.c
--- abcmidi-20050101.original/drawtune.c	2004-09-18 13:05:04.000000000 +0100
+++ abcmidi-20050101/drawtune.c	2005-07-10 12:29:49.263822520 +0100
@@ -29,7 +29,7 @@
 #endif
 
 #include <stdio.h>
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
diff -urN abcmidi-20050101.original/genmidi.c abcmidi-20050101/genmidi.c
--- abcmidi-20050101.original/genmidi.c	2004-12-18 19:32:07.000000000 +0000
+++ abcmidi-20050101/genmidi.c	2005-07-10 12:30:20.931008376 +0100
@@ -39,7 +39,7 @@
 #include "genmidi.h"
 #include "midifile.h"
 #include <stdio.h>
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <string.h>
 #include <ctype.h>
 #endif
diff -urN abcmidi-20050101.original/mftext.c abcmidi-20050101/mftext.c
--- abcmidi-20050101.original/mftext.c	2003-03-29 18:59:28.000000000 +0000
+++ abcmidi-20050101/mftext.c	2005-07-10 12:52:41.324237632 +0100
@@ -8,8 +8,9 @@
  */
 
 #include <stdio.h>
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <ctype.h>
+#include <stdlib.h>
 #endif
 #include "midifile.h"
 
diff -urN abcmidi-20050101.original/midi2abc.c abcmidi-20050101/midi2abc.c
--- abcmidi-20050101.original/midi2abc.c	2004-12-18 19:31:28.000000000 +0000
+++ abcmidi-20050101/midi2abc.c	2005-07-10 12:50:07.767581792 +0100
@@ -61,7 +61,7 @@
 #define strchr index
 #endif
 
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -190,7 +190,7 @@
 struct atrack track[64];
 int trackcount = 0;
 int maxbarcount = 0;
-/* maxbarcount  is used to return the numbers of bars created.
+/* maxbarcount  is used to return the numbers of bars created. */
 /* obpl is a flag for one bar per line. */
 
 /* double linked list of notes */
@@ -246,7 +246,7 @@
   char msg[256];
 
   sprintf(msg, "Error: Time=%ld Track=%d %s\n", Mf_currtime, trackno, s);
-  printf(msg);
+  puts(msg);
 }
 
 
@@ -1626,7 +1626,7 @@
 void handletext(t, textplace, trackno)
 /* print out text occuring in the body of the track */
 /* The text is printed out at the appropriate place within the track */
-/* In addition the function handles key signature and time
+/* In addition the function handles key signature and time */
 /* signature changes that can occur in the middle of the tune. */
 long t;
 struct tlistx** textplace;
@@ -1848,8 +1848,8 @@
    abc file.
 */
 char * loc;
-while (loc  = (char *) strchr(str,'\r')) *loc = ' ';
-while (loc  = (char *) strchr(str,'\n')) *loc = ' ';
+while ((loc  = (char *) strchr(str,'\r'))) *loc = ' ';
+while ((loc  = (char *) strchr(str,'\n'))) *loc = ' ';
 }
 
 
@@ -2368,7 +2368,7 @@
   };
 
 /* If key signature is not known find the best one.              */
-  if (keysig == -50 && gotkeysig ==0 || guessk) {
+  if ((keysig == -50 && gotkeysig ==0) || guessk) {
        keysig = findkey(maintrack);
        if (summary>0) printf("Best key signature = %d flats/sharps\n",keysig);
        }
diff -urN abcmidi-20050101.original/midicopy.c abcmidi-20050101/midicopy.c
--- abcmidi-20050101.original/midicopy.c	2004-09-18 13:25:26.000000000 +0100
+++ abcmidi-20050101/midicopy.c	2005-07-10 12:32:55.620492000 +0100
@@ -44,14 +44,23 @@
 #define NULLFUNC 0
 #define NULL 0
 
+/* Microsoft Visual C++ Version 6.0 or higher */
+#ifdef _MSC_VER
+#define ANSILIBS
+#endif
+
 #ifndef PCCFIX
 #include <stdlib.h>
 #endif
 
 #include <stdio.h>
 
+#if defined(ANSILIBS) || defined(__STDC__)
+#include <string.h>
+#include <stdlib.h>
+#else
 char *strcpy(), *strcat();
-
+#endif
 
 /* Functions to be called while processing the MIDI file. */
 int (*Mf_arbitrary) () = NULLFUNC;
diff -urN abcmidi-20050101.original/midifile.c abcmidi-20050101/midifile.c
--- abcmidi-20050101.original/midifile.c	2004-10-16 22:15:07.000000000 +0100
+++ abcmidi-20050101/midifile.c	2005-07-10 12:46:19.373303000 +0100
@@ -59,7 +59,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <string.h>
 #include <stdlib.h>
 #else
@@ -68,7 +68,22 @@
 
 /* int exit(), free(); */ /* Line commmented out JRA 19/12/95 */
 
-/* public stuff */
+static int readtrack();
+static void readheader();
+static void badbyte();
+static void metaevent();
+static void sysex();
+static void chanmessage();
+static void msginit();
+static void msgadd();
+static void biggermsg();
+static void mf_write_track_chunk();
+static void mf_write_header_chunk();
+static void WriteVarLen();
+static void write32bit();
+static void write16bit();
+static int msgleng();
+static int eputc();
 
 /* Functions to be called while processing the MIDI file. */
 int (*Mf_getc)() = NULLFUNC;
diff -urN abcmidi-20050101.original/midifile.h abcmidi-20050101/midifile.h
--- abcmidi-20050101.original/midifile.h	2003-03-29 15:38:38.000000000 +0000
+++ abcmidi-20050101/midifile.h	2005-07-10 12:44:03.894898848 +0100
@@ -34,26 +34,10 @@
 long mf_sec2ticks();
 void mfwrite();
 void mfread();
-static int readtrack();
 int mf_write_meta_event();
 int mf_write_midi_event();
 void mf_write_tempo();
-static void readheader();
 void mferror();
-static void badbyte();
-static void metaevent();
-static void sysex();
-static void chanmessage();
-static void msginit();
-static void msgadd();
-static void biggermsg();
-static void mf_write_track_chunk();
-static void mf_write_header_chunk();
-static void WriteVarLen();
-static void write32bit();
-static void write16bit();
-static int msgleng();
-static int eputc();
 
 /* MIDI status commands most significant bit is 1 */
 #define note_off         	0x80
diff -urN abcmidi-20050101.original/parseabc.c abcmidi-20050101/parseabc.c
--- abcmidi-20050101.original/parseabc.c	2004-11-09 15:22:07.000000000 +0000
+++ abcmidi-20050101/parseabc.c	2005-07-10 12:40:49.203496440 +0100
@@ -34,6 +34,7 @@
 #include "parseabc.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define SIZE_ABBREVIATIONS ('Z' - 'H' + 1)
 
@@ -55,7 +56,7 @@
 #define strchr index
 #endif
 
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1462,7 +1463,6 @@
   int i;
   char playonrep_list[80];
   int decorators[DECSIZE];
-  int n,m;
 
   event_startmusicline();
   endchar = ' ';
diff -urN abcmidi-20050101.original/position.c abcmidi-20050101/position.c
--- abcmidi-20050101.original/position.c	2004-09-17 00:12:44.000000000 +0100
+++ abcmidi-20050101/position.c	2005-07-10 12:34:11.939889688 +0100
@@ -25,7 +25,7 @@
 /* a line of music. */
 
 #include <stdio.h>
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <stdlib.h>
 #endif
 #include "abc.h"
diff -urN abcmidi-20050101.original/pslib.c abcmidi-20050101/pslib.c
--- abcmidi-20050101.original/pslib.c	2002-01-24 07:23:30.000000000 +0000
+++ abcmidi-20050101/pslib.c	2005-07-10 12:34:36.088218584 +0100
@@ -41,7 +41,7 @@
 /*  #define ANSILIBS is just used to access time functions for */
 /*  %%CreationDate . This can safely be removed if it causes   */
 /*  compilation problems */
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <time.h>
 #endif
 #include "drawtune.h"
diff -urN abcmidi-20050101.original/store.c abcmidi-20050101/store.c
--- abcmidi-20050101.original/store.c	2005-07-10 12:20:07.000000000 +0100
+++ abcmidi-20050101/store.c	2005-07-10 12:41:38.736966208 +0100
@@ -61,7 +61,7 @@
 #define strchr index
 #endif
 
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -785,7 +785,6 @@
   char msg[200], command[40];
   char *p;
   int done;
-  int bytesleft;
 
   if (strcmp(package, "MIDI") == 0) {
     int ch;
@@ -1235,7 +1234,7 @@
 /* converts a P: field to a list of part labels */
 /* e.g. P:A(AB)3(CD)2 becomes P:AABABABCDCD */
 
-/********** This feature is not supported ********[SS] 2004-10-08
+/********** This feature is not supported ********[SS] 2004-10-08      */
 /* A '+' indicates 'additive' behaviour (a part may include repeats).  */
 /* A '-' indicates 'non-additive' behaviour (repeat marks in the music */
 /* are ignored and only repeats implied by the part order statement    */
diff -urN abcmidi-20050101.original/toabc.c abcmidi-20050101/toabc.c
--- abcmidi-20050101.original/toabc.c	2004-11-09 15:20:20.000000000 +0000
+++ abcmidi-20050101/toabc.c	2005-07-10 12:52:19.832504872 +0100
@@ -37,7 +37,7 @@
 #define strchr index
 #endif
 
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -256,7 +256,7 @@
             printf("w:");
             foundtext = 1;
           };
-          printf(barlyrics->words);
+          puts(barlyrics->words);
         };
         count = new_barcount(p->type, &foundbar, count);
         p = p->next;
@@ -2116,7 +2116,6 @@
 /* accidental = 10 nothing specified, determine from context        */
 {
   int p;
-  int acc;
   int mul, noteno;
   static int scale[7] = {0, 2, 4, 5, 7, 9, 11};
   char *anoctave = "cdefgab";
diff -urN abcmidi-20050101.original/yapstree.c abcmidi-20050101/yapstree.c
--- abcmidi-20050101.original/yapstree.c	2004-12-18 19:31:46.000000000 +0000
+++ abcmidi-20050101/yapstree.c	2005-07-10 12:36:29.261013704 +0100
@@ -33,7 +33,7 @@
 #define ANSILIBS
 #endif
 
-#ifdef ANSILIBS
+#if defined(ANSILIBS) || defined(__STDC__)
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>

Reply via email to