Sólo en libsmf/: COPYING diff -ru ../libsmf-1.2/src//Makefile.am libsmf//Makefile.am --- ../libsmf-1.2/src//Makefile.am 2008-12-13 06:22:30.000000000 -0600 +++ libsmf//Makefile.am 2011-04-30 13:04:40.494630075 -0600 @@ -1,11 +1,5 @@ -include_HEADERS = smf.h - -lib_LTLIBRARIES = libsmf.la -libsmf_la_SOURCES = smf.h smf_private.h smf.c smf_decode.c smf_load.c smf_save.c smf_tempo.c -libsmf_la_CFLAGS = $(GLIB_CFLAGS) -DG_LOG_DOMAIN=\"libsmf\" - -bin_PROGRAMS = smfsh -smfsh_SOURCES = smfsh.c -smfsh_CFLAGS = $(GLIB_CFLAGS) -DG_LOG_DOMAIN=\"smfsh\" -smfsh_LDADD = libsmf.la $(GLIB_LIBS) $(READLINE_LIBS) -lm +noinst_HEADERS = smf.h +noinst_LIBRARIES = libsmf.a +libsmf_a_SOURCES = smf.h smf_private.h smf.c smf_decode.c smf_load.c smf_save.c smf_tempo.c +libsmf_a_CFLAGS = $(GLIB_CFLAGS) -DG_LOG_DOMAIN=\"libsmf\" Sólo en ../libsmf-1.2/src/: Makefile.in diff -ru ../libsmf-1.2/src//smf.c libsmf//smf.c --- ../libsmf-1.2/src//smf.c 2008-12-13 06:25:29.000000000 -0600 +++ libsmf//smf.c 2011-04-30 13:04:40.494630075 -0600 @@ -39,7 +39,11 @@ #include #include #include +#ifdef __MINGW32__ +#include +#else /* ! __MINGW32__ */ #include +#endif /* ! __MINGW32__ */ #include "smf.h" #include "smf_private.h" diff -ru ../libsmf-1.2/src//smf_decode.c libsmf//smf_decode.c --- ../libsmf-1.2/src//smf_decode.c 2008-12-13 06:22:30.000000000 -0600 +++ libsmf//smf_decode.c 2011-04-30 13:04:40.494630075 -0600 @@ -37,7 +37,11 @@ #include #include #include +#ifdef __MINGW32__ +#include +#else /* ! __MINGW32__ */ #include +#endif /* ! __MINGW32__ */ #include #include "smf.h" #include "smf_private.h" diff -ru ../libsmf-1.2/src//smf.h libsmf//smf.h --- ../libsmf-1.2/src//smf.h 2008-12-13 06:22:30.000000000 -0600 +++ libsmf//smf.h 2011-04-30 13:04:40.494630075 -0600 @@ -287,6 +287,12 @@ /** Absolute time of next event on events_queue. */ int time_of_next_event; GPtrArray *events_array; + + /** API consumer is free to use this for whatever purpose. NULL in freshly allocated track. + Note that tracks might be deallocated not only explicitly, by calling smf_track_delete(), + but also implicitly, e.g. when calling smf_delete() with tracks still added to + the smf; there is no mechanism for libsmf to notify you about removal of the track. */ + void *user_pointer; }; typedef struct smf_track_struct smf_track_t; @@ -317,6 +323,12 @@ /** Length of the MIDI message in the buffer, in bytes. */ int midi_buffer_length; + + /** API consumer is free to use this for whatever purpose. NULL in freshly allocated event. + Note that events might be deallocated not only explicitly, by calling smf_event_delete(), + but also implicitly, e.g. when calling smf_track_delete() with events still added to + the track; there is no mechanism for libsmf to notify you about removal of the event. */ + void *user_pointer; }; typedef struct smf_event_struct smf_event_t; diff -ru ../libsmf-1.2/src//smf_load.c libsmf//smf_load.c --- ../libsmf-1.2/src//smf_load.c 2008-12-13 06:22:30.000000000 -0600 +++ libsmf//smf_load.c 2011-04-30 13:04:40.494630075 -0600 @@ -40,7 +40,11 @@ #include #include #include +#ifdef __MINGW32__ +#include +#else /* ! __MINGW32__ */ #include +#endif /* ! __MINGW32__ */ #include "smf.h" #include "smf_private.h" @@ -79,8 +83,8 @@ smf->next_chunk_offset += sizeof(struct chunk_header_struct) + ntohl(chunk->length); if (smf->next_chunk_offset > smf->file_buffer_length) { - g_critical("SMF error: malformed chunk; truncated file?"); - return (NULL); + g_critical("SMF warning: malformed chunk; truncated file?"); + smf->next_chunk_offset = smf->file_buffer_length; } return (chunk); @@ -286,7 +290,8 @@ return (-1); } - extract_vlq(second_byte, buffer_length, &sysex_length, &len); + if (extract_vlq(second_byte, buffer_length, &sysex_length, &len)) + return (-1); if (consumed_bytes != NULL) *consumed_bytes = len; @@ -770,8 +775,14 @@ event = parse_next_event(track); /* Couldn't parse an event? */ - if (event == NULL) - return (-1); + if (event == NULL) { + g_critical("Unable to parse MIDI event; truncating track."); + if (smf_track_add_eot_delta_pulses(track, 0) != 0) { + g_critical("smf_track_add_eot_delta_pulses failed."); + return (-2); + } + break; + } assert(smf_event_is_valid(event)); @@ -792,7 +803,7 @@ static int load_file_into_buffer(void **file_buffer, int *file_buffer_length, const char *file_name) { - FILE *stream = fopen(file_name, "r"); + FILE *stream = fopen(file_name, "rb"); if (stream == NULL) { g_critical("Cannot open input file: %s", strerror(errno)); diff -ru ../libsmf-1.2/src//smf_save.c libsmf//smf_save.c --- ../libsmf-1.2/src//smf_save.c 2008-12-13 06:22:30.000000000 -0600 +++ libsmf//smf_save.c 2011-04-30 13:04:40.498630091 -0600 @@ -39,7 +39,11 @@ #include #include #include +#ifdef __MINGW32__ +#include +#else /* ! __MINGW32__ */ #include +#endif /* ! __MINGW32__ */ #include "smf.h" #include "smf_private.h" @@ -395,7 +399,7 @@ { FILE *stream; - stream = fopen(file_name, "w+"); + stream = fopen(file_name, "wb+"); if (stream == NULL) { g_critical("Cannot open input file: %s", strerror(errno)); Sólo en ../libsmf-1.2/src/: smfsh.c Sólo en libsmf/: TODO