# HG changeset patch # User nenolod # Date 1138484734 28800 # Node ID 3f45ec88fcd3e8c6f47e6f4daadf03831bf00339 # Parent 4eb4a52f440e7302336e28c07e04666ad0324dc5 [svn] fix giacomo's bug I think diff -r 4eb4a52f440e -r 3f45ec88fcd3 Plugins/Input/amidi-plug/amidi-plug.c --- a/Plugins/Input/amidi-plug/amidi-plug.c Sat Jan 28 11:49:45 2006 -0800 +++ b/Plugins/Input/amidi-plug/amidi-plug.c Sat Jan 28 13:45:34 2006 -0800 @@ -31,15 +31,19 @@ static gint amidiplug_is_our_file( gchar * filename ) { #ifdef MIDIFILE_PROBE_MAGICBYTES - FILE * fp; + VFSFile * fp; gchar magic_bytes[4]; - fp = fopen( filename , "rb" ); - fread( magic_bytes , 1 , 4 , fp ); + fp = vfs_fopen( filename , "rb" ); + + if (fp == NULL) + return FALSE; + + vfs_fread( magic_bytes , 1 , 4 , fp ); if ( !strncmp( magic_bytes , "MThd" , 4 ) ) { - fclose( fp ); + vfs_fclose( fp ); DEBUGMSG( "MIDI found, %s is a standard midi file\n" , filename ); return TRUE; } @@ -48,16 +52,16 @@ { /* skip the four bytes after RIFF, then read the next four */ - fseek( fp , 4 , SEEK_CUR ); - fread( magic_bytes , 1 , 4 , fp ); + vfs_fseek( fp , 4 , SEEK_CUR ); + vfs_fread( magic_bytes , 1 , 4 , fp ); if ( !strncmp( magic_bytes , "RMID" , 4 ) ) { - fclose( fp ); + vfs_fclose( fp ); DEBUGMSG( "MIDI found, %s is a riff midi file\n" , filename ); return TRUE; } } - fclose( fp ); + vfs_fclose( fp ); #else gchar * ext = strrchr( filename, '.' ); /* check the filename extension */