change all use of g_critical() in libsmf() to g_warning()
[ardour.git] / libs / evoral / src / libsmf / smf.c
index 79b355c7dcd439c0d4f9590e1287b570eb04a725..f88c85ffab13e13550722a0f8bda2dd6e8635d30 100644 (file)
@@ -58,7 +58,7 @@ smf_new(void)
 
        smf_t *smf = (smf_t*)malloc(sizeof(smf_t));
        if (smf == NULL) {
-               g_critical("Cannot allocate smf_t structure: %s", strerror(errno));
+               g_warning("Cannot allocate smf_t structure: %s", strerror(errno));
                return (NULL);
        }
 
@@ -111,7 +111,7 @@ smf_track_new(void)
 {
        smf_track_t *track = (smf_track_t*)malloc(sizeof(smf_track_t));
        if (track == NULL) {
-               g_critical("Cannot allocate smf_track_t structure: %s", strerror(errno));
+               g_warning("Cannot allocate smf_track_t structure: %s", strerror(errno));
                return (NULL);
        }
 
@@ -239,7 +239,7 @@ smf_event_new(void)
 {
        smf_event_t *event = (smf_event_t*)malloc(sizeof(smf_event_t));
        if (event == NULL) {
-               g_critical("Cannot allocate smf_event_t structure: %s", strerror(errno));
+               g_warning("Cannot allocate smf_event_t structure: %s", strerror(errno));
                return (NULL);
        }
 
@@ -272,7 +272,7 @@ smf_event_new_from_pointer(const void *midi_data, size_t len)
        event->midi_buffer_length = len;
        event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
-               g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
+               g_warning("Cannot allocate MIDI buffer structure: %s", strerror(errno));
                smf_event_delete(event);
 
                return (NULL);
@@ -311,19 +311,19 @@ smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte)
                return (NULL);
 
        if (first_byte < 0) {
-               g_critical("First byte of MIDI message cannot be < 0");
+               g_warning("First byte of MIDI message cannot be < 0");
                smf_event_delete(event);
 
                return (NULL);
        }
 
        if (first_byte > 255) {
-               g_critical("smf_event_new_from_bytes: first byte is %d, which is larger than 255.", first_byte);
+               g_warning("smf_event_new_from_bytes: first byte is %d, which is larger than 255.", first_byte);
                return (NULL);
        }
 
        if (!is_status_byte(first_byte)) {
-               g_critical("smf_event_new_from_bytes: first byte is not a valid status byte.");
+               g_warning("smf_event_new_from_bytes: first byte is not a valid status byte.");
                return (NULL);
        }
 
@@ -337,24 +337,24 @@ smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte)
 
        if (len > 1) {
                if (second_byte > 255) {
-                       g_critical("smf_event_new_from_bytes: second byte is %d, which is larger than 255.", second_byte);
+                       g_warning("smf_event_new_from_bytes: second byte is %d, which is larger than 255.", second_byte);
                        return (NULL);
                }
 
                if (is_status_byte(second_byte)) {
-                       g_critical("smf_event_new_from_bytes: second byte cannot be a status byte.");
+                       g_warning("smf_event_new_from_bytes: second byte cannot be a status byte.");
                        return (NULL);
                }
        }
 
        if (len > 2) {
                if (third_byte > 255) {
-                       g_critical("smf_event_new_from_bytes: third byte is %d, which is larger than 255.", third_byte);
+                       g_warning("smf_event_new_from_bytes: third byte is %d, which is larger than 255.", third_byte);
                        return (NULL);
                }
 
                if (is_status_byte(third_byte)) {
-                       g_critical("smf_event_new_from_bytes: third byte cannot be a status byte.");
+                       g_warning("smf_event_new_from_bytes: third byte cannot be a status byte.");
                        return (NULL);
                }
        }
@@ -362,7 +362,7 @@ smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte)
        event->midi_buffer_length = len;
        event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
-               g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
+               g_warning("Cannot allocate MIDI buffer structure: %s", strerror(errno));
                smf_event_delete(event);
 
                return (NULL);
@@ -675,7 +675,7 @@ smf_set_format(smf_t *smf, int format)
        assert(format == 0 || format == 1);
 
        if (smf->number_of_tracks > 1 && format == 0) {
-               g_critical("There is more than one track, cannot set format to 0.");
+               g_warning("There is more than one track, cannot set format to 0.");
                return (-1);
        }
 
@@ -1008,7 +1008,7 @@ smf_seek_to_seconds(smf_t *smf, double seconds)
                event = smf_peek_next_event(smf);
 
                if (event == NULL) {
-                       g_critical("Trying to seek past the end of song.");
+                       g_warning("Trying to seek past the end of song.");
                        return (-1);
                }
 
@@ -1042,7 +1042,7 @@ smf_seek_to_pulses(smf_t *smf, size_t pulses)
                event = smf_peek_next_event(smf);
 
                if (event == NULL) {
-                       g_critical("Trying to seek past the end of song.");
+                       g_warning("Trying to seek past the end of song.");
                        return (-1);
                }