if(e->event.type == ME_WRD) 
if (e->event.type == ME_WRD || e->event.type == ME_SHERRY) 
MidiEvent *read_midi_file(struct timidity_file *tf, int32 *count, int32 *sp,			  char *fn){    char magic[4];    MidiEvent *ev;    int err, macbin_check, mtype, i;    macbin_check = 1;    current_file_info = get_midi_file_info(current_filename, 1);    COPY_CHANNELMASK(drumchannels, current_file_info->drumchannels);    COPY_CHANNELMASK(drumchannel_mask, current_file_info->drumchannel_mask);    errno = 0;    if((mtype = get_module_type(fn)) > 0)    {	readmidi_read_init();    	if(!IS_URL_SEEK_SAFE(tf->url))    	    tf->url = url_cache_open(tf->url, 1);  	err = load_module_file(tf, mtype);	if(!err)	{	    current_file_info->format = 0;	    memset(&drumchannels, 0, sizeof(drumchannels));	    goto grooming;	}	free_midi_list();	if(err == 2)	    return NULL;	url_rewind(tf->url);	url_cache_disable(tf->url);    }#if MAX_CHANNELS > 16    for(i = 16; i < MAX_CHANNELS; i++)    {	if(!IS_SET_CHANNELMASK(drumchannel_mask, i))	{	    if(IS_SET_CHANNELMASK(drumchannels, i & 0xF))		SET_CHANNELMASK(drumchannels, i);	    else		UNSET_CHANNELMASK(drumchannels, i);	}    }#endif    if(opt_default_mid &&       (current_file_info->mid == 0 || current_file_info->mid >= 0x7e))	current_file_info->mid = opt_default_mid;  retry_read:    if(tf_read(magic, 1, 4, tf) != 4)    {	if(errno)	    ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", current_filename,		      strerror(errno));	else	    ctl->cmsg(CMSG_WARNING, VERB_NORMAL,		      "%s: Not a MIDI file!", current_filename);	return NULL;    }    if(memcmp(magic, "MThd", 4) == 0)    {	readmidi_read_init();	err = read_smf_file(tf);    }    else if(memcmp(magic, "RCM-", 4) == 0 || memcmp(magic, "COME", 4) == 0)    {	readmidi_read_init();	err = read_rcp_file(tf, magic, fn);    }    else if (strncmp(magic, "RIFF", 4) == 0) {       if (tf_read(magic, 1, 4, tf) == 4 &&           tf_read(magic, 1, 4, tf) == 4 &&           strncmp(magic, "RMID", 4) == 0 &&           tf_read(magic, 1, 4, tf) == 4 &&           strncmp(magic, "data", 4) == 0 &&           tf_read(magic, 1, 4, tf) == 4) {           goto retry_read;       } else {           err = 1;           ctl->cmsg(CMSG_WARNING, VERB_NORMAL,                     "%s: Not a MIDI file!", current_filename);       }    }    else if(memcmp(magic, "melo", 4) == 0)    {	readmidi_read_init();	err = read_mfi_file(tf);    }    else    {	if(macbin_check && magic[0] == 0)	{	    /* Mac Binary */	    macbin_check = 0;	    skip(tf, 128 - 4);	    goto retry_read;	}	else if(memcmp(magic, "RIFF", 4) == 0)	{	    /* RIFF MIDI file */	    skip(tf, 20 - 4);	    goto retry_read;	}	err = 1;	ctl->cmsg(CMSG_WARNING, VERB_NORMAL,		  "%s: Not a MIDI file!", current_filename);    }    if(err)    {	free_midi_list();	if(string_event_strtab.nstring > 0)	    delete_string_table(&string_event_strtab);	return NULL;    }    /* Read WRD file */    if(!(play_mode->flag&PF_CAN_TRACE))    {	if(wrdt->start != NULL)	    wrdt->start(WRD_TRACE_NOTHING);	readmidi_wrd_mode = WRD_TRACE_NOTHING;    }    else if(wrdt->id != '-' && wrdt->opened)    {	readmidi_wrd_mode = import_wrd_file(fn);	if(wrdt->start != NULL)	    if(wrdt->start(readmidi_wrd_mode) == -1)	    {		/* strip all WRD events */		MidiEventList *e;		int32 i;		for(i = 0, e = evlist; i < event_count; i++, e = e->next)		    if(e->event.type == ME_WRD)			e->event.type = ME_NONE;	    }    }    else	readmidi_wrd_mode = WRD_TRACE_NOTHING;    /* make lyric table */    if(string_event_strtab.nstring > 0)    {	string_event_table_size = string_event_strtab.nstring;	string_event_table = make_string_array(&string_event_strtab);	if(string_event_table == NULL)	{	    delete_string_table(&string_event_strtab);	    string_event_table_size = 0;	}    }  grooming:    insert_note_steps();    ev = groom_list(current_file_info->divisions, count, sp);    if(ev == NULL)    {	free_midi_list();	if(string_event_strtab.nstring > 0)	    delete_string_table(&string_event_strtab);	return NULL;    }    current_file_info->samples = *sp;    if(current_file_info->first_text == NULL)	current_file_info->first_text = safe_strdup("");    current_file_info->readflag = 1;    return ev;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/f0a00f9cf340d798cca25cec7ebb2e2d3e9aa33a/readmidi.c/buggy/timidity/readmidi.c