X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fvst_info_file.cc;h=3b56876494b93b8bcfbec016736540a4635cecee;hb=8367b7cab344e75908744a95fda860c7fadff420;hp=4037aec91b5240b2dba046ea273643d06e888b60;hpb=848db8fbd56dbae1ad286b7791dba293462b5f43;p=ardour.git diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index 4037aec91b..3b56876494 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -97,6 +97,7 @@ vstfx_cache_file (const char* dllpath, int personal, const char *ext) string dir; if (personal) { dir = get_personal_vst_info_cache_dir(); + // TODO prefix path relative to scan-root to avoid duplicates } else { dir = Glib::path_get_dirname (std::string(dllpath)); } @@ -227,6 +228,12 @@ vstfx_load_info_block(FILE* fp, VSTInfo *info) info->wantMidi = 1; } + if ((info->numParams) == 0) { + info->ParamNames = NULL; + info->ParamLabels = NULL; + return true; + } + if ((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) { return false; } @@ -344,9 +351,15 @@ vstfx_write_info_file (FILE* fp, vector *infos) static bool vstfx_blacklist_stat (const char *dllpath, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { return true; } + string const path = vstfx_blacklist_path (dllpath, personal); if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) { @@ -428,7 +441,12 @@ vstfx_remove_infofile (const char *dllpath) static char * vstfx_infofile_stat (const char *dllpath, struct stat* statbuf, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { return 0; } @@ -487,8 +505,13 @@ vstfx_infofile_for_read (const char* dllpath) static FILE * vstfx_infofile_create (const char* dllpath, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { - return 0; + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { + return NULL; } string const path = vstfx_infofile_path (dllpath, personal); @@ -546,7 +569,7 @@ bool vstfx_midi_input (VSTState* vstfx) if (vst_version >= 2) { /* should we send it VST events (i.e. MIDI) */ - if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "receiveVstEvents", 0.0f) > 0)) { + if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("receiveVstEvents"), 0.0f) > 0)) { return true; } } @@ -564,8 +587,8 @@ bool vstfx_midi_output (VSTState* vstfx) if (vst_version >= 2) { /* should we send it VST events (i.e. MIDI) */ - if ( (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstEvents", 0.0f) > 0) - || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstMidiEvent", 0.0f) > 0) + if ( (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("sendVstEvents"), 0.0f) > 0) + || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("sendVstMidiEvent"), 0.0f) > 0) ) { return true; }