summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hatina <phatina@redhat.com>2012-04-23 12:52:13 +0200
committerPeter Hatina <phatina@redhat.com>2012-04-23 12:57:18 +0200
commitfc52cb81a96f223811caa002b35beadc6aa85939 (patch)
treeca4f323529b2eb22ef96f75e092830bd2f4afe25
parentd07338d17d0395b3df13e78472c283b0e4851c82 (diff)
remove leading 's' from all spice channel names
-rw-r--r--SpiceXPI/src/plugin/plugin.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 8acde24..d12d02c 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -330,18 +330,24 @@ void nsPluginInstance::SetSSLChannels(const char *aSSLChannels)
m_ssl_channels = aSSLChannels;
/*
- * HACK -- remove leading s from m_SSLChannels, e.g. "main" not "smain"
+ * Backward Compatibility: Begin
+ * Remove leading 's' from m_ssl_channels, e.g. "main" not "smain"
* RHEL5 uses 'smain' and 'sinpusts
* RHEL6 uses 'main' and 'inputs'
*/
- std::size_t found = 0;
- while ((found = m_ssl_channels.find("smain", found)) != std::string::npos)
- m_ssl_channels.replace(found, 5, "main");
-
- found = 0;
- while ((found = m_ssl_channels.find("sinputs", found)) != std::string::npos)
- m_ssl_channels.replace(found, 7, "inputs");
- /* HACK */
+ const char* chan_names[] = {
+ "smain", "sdisplay", "sinputs",
+ "scursor", "splayback", "srecord"
+ };
+ const int nnames = sizeof(chan_names) / sizeof(chan_names[0]);
+
+ for (int i = 0; i < nnames; i++) {
+ const char *name = chan_names[i];
+ size_t found = 0;
+ while ((found = m_ssl_channels.find(name, found)) != std::string::npos)
+ m_ssl_channels.replace(found, strlen(name), name + 1);
+ }
+ /* Backward Compatibility: End */
}
//* attribute string TrustStore; */