foxygit / doom Log in
commit 2e8f6da6fdf0eb71e58d2cdaad24e5b0a332f675
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Fri May 8 08:43:19 2015 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Fri May 8 08:43:19 2015 +0200

    warnings: fix ".. may be used uninitialized in this function" warnings

    Actually, it was already impossible for the reported variables to be
    used uninitialized, because they were all assigned a value by calling
    ReadByte() and the function would return if that failed. However, the
    compiler couldn't know about this fact, so we do him the favor and
    initialized them to 0.
---
 src/midifile.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/midifile.c b/src/midifile.c
index 92ffd803..1ab4ecdb 100644
--- a/src/midifile.c
+++ b/src/midifile.c
@@ -130,7 +130,7 @@ static boolean ReadByte(byte *result, FILE *stream)
 static boolean ReadVariableLength(unsigned int *result, FILE *stream)
 {
     int i;
-    byte b;
+    byte b = 0;

     *result = 0;

@@ -203,7 +203,7 @@ static boolean ReadChannelEvent(midi_event_t *event,
                                 byte event_type, boolean two_param,
                                 FILE *stream)
 {
-    byte b;
+    byte b = 0;

     // Set basics:

@@ -269,7 +269,7 @@ static boolean ReadSysExEvent(midi_event_t *event, int event_type,

 static boolean ReadMetaEvent(midi_event_t *event, FILE *stream)
 {
-    byte b;
+    byte b = 0;

     event->event_type = MIDI_EVENT_META;

@@ -308,7 +308,7 @@ static boolean ReadMetaEvent(midi_event_t *event, FILE *stream)
 static boolean ReadEvent(midi_event_t *event, unsigned int *last_event_type,
                          FILE *stream)
 {
-    byte event_type;
+    byte event_type = 0;

     if (!ReadVariableLength(&event->delta_time, stream))
     {