Mercurial > audlegacy-plugins
changeset 321:f2341e9c17e4 trunk
[svn] - fix is_our_file() behaviour
author | nenolod |
---|---|
date | Thu, 30 Nov 2006 22:50:44 -0800 |
parents | ce0e18cac755 |
children | 32dad60229d6 |
files | ChangeLog src/console/Audacious_Driver.cxx |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Nov 30 21:22:11 2006 -0800 +++ b/ChangeLog Thu Nov 30 22:50:44 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-01 05:22:11 +0000 William Pitcock <nenolod@nenolod.net> + revision [704] + - return -1 (nonfatal error) in legacy is_our_file. + + trunk/src/console/Audacious_Driver.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2006-12-01 05:08:17 +0000 William Pitcock <nenolod@nenolod.net> revision [702] - make multitrack mods work again
--- a/src/console/Audacious_Driver.cxx Thu Nov 30 21:22:11 2006 -0800 +++ b/src/console/Audacious_Driver.cxx Thu Nov 30 22:50:44 2006 -0800 @@ -424,7 +424,30 @@ static gint is_our_file( gchar* filename ) { - return -1; + VFSFile *fd; + gint ret = 0; + + Url_Parser url( filename ); + if ( !url.path ) return false; + + // open file if not already open + Vfs_File_Reader in; + if ( !fd ) + { + if ( log_err( in.open( url.path ) ) ) return false; + fd = in.file(); + // in will be closed when function ends + } + + // read header and identify type + gchar header [4] = { }; + vfs_fread( header, sizeof header, 1, fd ); + gme_type_t type = gme_identify_extension( gme_identify_header( header ), gme_type_list() ); + + if ( type ) + ret = 1; + + return ret; } // Setup