Browse Source

Fixed magic character bug in plugin chooser - magic chars / and | now escaped

master
waxfrenzy 22 years ago
parent
commit
32ed706ed9
1 changed files with 29 additions and 3 deletions
  1. +29
    -3
      SpiralSound/Plugins/LADSPAPlugin/LADSPAPluginGUI.C

+ 29
- 3
SpiralSound/Plugins/LADSPAPlugin/LADSPAPluginGUI.C View File

@@ -98,11 +98,37 @@ SpiralPluginGUI(w,h,o,ch)
m_Browser->callback((Fl_Callback *)cb_Select);

m_Browser->add("(None)");
for (vector<LADSPAInfo::PluginEntry>::iterator i=m_PluginList.begin();
for (vector<LADSPAInfo::PluginEntry>::iterator i=m_PluginList.begin();
i!=m_PluginList.end(); i++)
{
m_Browser->add(i->Name.c_str());
}
unsigned long len = i->Name.length();
unsigned long esc_count = 0;
const char *tmp = i->Name.c_str();
char *dest;

for (unsigned long c = 0; c < len; c++) {
if (tmp[c] == '/') esc_count++;
}

dest = (char *)malloc(len + 1 + esc_count);

if (dest) {
unsigned long d = 0;
for (unsigned long c = 0; c < len; c++, d++) {
if (tmp[c] == '/' || tmp[c] = '|') {
dest[d] = '\\';
d++;
dest[d] = tmp[c];
} else {
dest[d] = tmp[c];
}
}
dest[len + esc_count] = '\0';
m_Browser->add(dest);
free(dest);
}
}
m_Browser->value(0);

m_SetupGroup->add(m_Browser);


Loading…
Cancel
Save