aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpplugin.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-08 23:45:18 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-08 23:45:18 +0800
commit1976c49f835267d33ef88bd3fc20d18363e12c0b (patch)
treee1eaca367a37238c1b2a5fc0f4ff7cb29a723a86 /qmidiplayer-desktop/qmpplugin.cpp
parent1afedc4cc39c1dcbe49f8c99843a1732bf22fa28 (diff)
downloadQMidiPlayer-1976c49f835267d33ef88bd3fc20d18363e12c0b.tar.xz
Add API version verification. This breaks compatibility
with old versions of plugins. Add RIFF MIDI support to the SMF reader. Documentation.
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 5f5d82e..96936bd 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -31,6 +31,11 @@ void qmpPluginManager::scanPlugins()
if(!hso){fprintf(stderr,"Error while loading library: %d\n",GetLastError());continue;}
FARPROC hndi=GetProcAddress(hso,"qmpPluginGetInterface");
if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;}
+ FARPROC hndiv=GetProcAddress(hso,"qmpPluginGetAPIRev");
+ if(!hndiv){fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;}
+ qmpPluginAPIRevEntry getv=(qmpPluginAPIRevEntry)hndiv;
+ if(strcmp(getv(),QMP_PLUGIN_API_REV))
+ {fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;}
qmpPluginEntry e=(qmpPluginEntry)hndi;
qmpPluginIntf* intf=e(pluginAPI);
plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf));
@@ -65,6 +70,11 @@ void qmpPluginManager::scanPlugins()
if(!hso){fprintf(stderr,"%s\n",dlerror());continue;}
void* hndi=dlsym(hso,"qmpPluginGetInterface");
if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;}
+ void* hndiv=dlsym(hso,"qmpPluginGetAPIRev");
+ if(!hndiv){fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;}
+ qmpPluginAPIRevEntry getv=(qmpPluginAPIRevEntry)hndiv;
+ if(strcmp(getv(),QMP_PLUGIN_API_REV))
+ {fprintf(stderr,"file %s is incompatible with this version of qmidiplayer.\n",cpluginpaths[i].c_str());continue;}
qmpPluginEntry e=(qmpPluginEntry)hndi;
qmpPluginIntf* intf=e(pluginAPI);
plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf));