]> git.donarmstrong.com Git - lilypond.git/commitdiff
Avoid comparison of unsigned < 0
authorGraham Percival <graham@percival-music.ca>
Fri, 9 Dec 2011 05:34:56 +0000 (21:34 -0800)
committerGraham Percival <graham@percival-music.ca>
Wed, 14 Dec 2011 09:51:06 +0000 (01:51 -0800)
  PyArg_ParseTuple (args, "s#|i", &track, &track_size, ...
returns the length as an int:
  http://docs.python.org/c-api/arg.html#PyArg_ParseTuple

python/midi.c

index 187268b78efc105fe44dfdeee9c345ea781a3c05..0a8599d0e203d90d22f7e3539c8e4067799ec4d0 100644 (file)
@@ -356,7 +356,7 @@ static PyObject *
 pymidi_parse_track (PyObject *self, PyObject *args)
 {
   unsigned char *track, *track_end;
-  unsigned long track_size;
+  int track_size;
   int clocks_max;
 
   debug_print ("%s", "\n");
@@ -398,9 +398,11 @@ midi_parse (unsigned char **midi,unsigned  char *midi_end, int clocks_max)
   division = get_number (midi, *midi + 2, 2) * 4;
 
 
+  /*
   if (division < 0)
-    /* return midi_error (cannot handle non-metrical time"); */
+    return midi_error (cannot handle non-metrical time");
     ;
+  */
   *midi += header_len - 6;
 
   pymidi = PyList_New (0);