# HG changeset patch # User chainsaw # Date 1136070274 28800 # Node ID 5d0a74c31ee65b53ae10c23639aebcd6351b20b8 # Parent fb59081b528f6f0a387eb58b8c2d0d6051dd7a30 [svn] Use file magic instead of extensions. diff -r fb59081b528f -r 5d0a74c31ee6 Plugins/Input/musepack/libmpc.cpp --- a/Plugins/Input/musepack/libmpc.cpp Sat Dec 31 14:47:56 2005 -0800 +++ b/Plugins/Input/musepack/libmpc.cpp Sat Dec 31 15:04:34 2005 -0800 @@ -202,11 +202,17 @@ static int mpcIsOurFile(char* p_Filename) { - char* ext; - ext = strrchr(p_Filename, '.'); - if(ext) - return !(strcasecmp(ext, ".mpc") && strcasecmp(ext, ".mpp") && strcasecmp(ext, ".mp+")); - return FALSE; + VFSFile *file; + gchar magic[3]; + if (file = vfs_fopen(p_Filename, "rb")) { + vfs_fread(magic, 1, 3, file); + if (!strncmp(magic, "MP+", 3)) { + vfs_fclose(file); + return 1; + } + vfs_fclose(file); + } + return 0; } static void mpcPlay(char* p_Filename) diff -r fb59081b528f -r 5d0a74c31ee6 Plugins/Input/musepack/libmpc.h --- a/Plugins/Input/musepack/libmpc.h Sat Dec 31 14:47:56 2005 -0800 +++ b/Plugins/Input/musepack/libmpc.h Sat Dec 31 15:04:34 2005 -0800 @@ -9,6 +9,7 @@ #include "libaudacious/util.h" #include "libaudacious/configdb.h" #include "libaudacious/titlestring.h" +#include "libaudacious/vfs.h" } //stdlib headers