Switch to side-by-side view

--- a/upmpd/ohproduct.cxx
+++ b/upmpd/ohproduct.cxx
@@ -172,67 +172,54 @@
 int OHProduct::setStandby(const SoapArgs& sc, SoapData& data)
 {
     LOGDEB("OHProduct::setStandby" << endl);
+    bool standby;
+    if (!sc.getBool("Value", &standby)) {
+        return UPNP_E_INVALID_PARAM;
+    }
+    return UPNP_E_SUCCESS;
+}
+
+int OHProduct::sourceCount(const SoapArgs& sc, SoapData& data)
+{
+    LOGDEB("OHProduct::sourceCount" << endl);
+    data.addarg("Value", "1");
+    return UPNP_E_SUCCESS;
+}
+
+int OHProduct::sourceXML(const SoapArgs& sc, SoapData& data)
+{
+    LOGDEB("OHProduct::sourceXML" << endl);
+    data.addarg("Value", csxml);
+    return UPNP_E_SUCCESS;
+}
+
+int OHProduct::sourceIndex(const SoapArgs& sc, SoapData& data)
+{
+    LOGDEB("OHProduct::sourceIndex" << endl);
+    data.addarg("Value", "0");
+    return UPNP_E_SUCCESS;
+}
+
+int OHProduct::setSourceIndex(const SoapArgs& sc, SoapData& data)
+{
+    LOGDEB("OHProduct::setSourceIndex" << endl);
+    int sindex;
+    if (!sc.getInt("Value", &sindex)) {
+        return UPNP_E_INVALID_PARAM;
+    }
+    LOGDEB("OHProduct::setSourceIndex: " << sindex << endl);
+    return UPNP_E_SUCCESS;
+}
+
+int OHProduct::setSourceIndexByName(const SoapArgs& sc, SoapData& data)
+{
+    LOGDEB("OHProduct::setSourceIndexByName" << endl);
     map<string, string>::const_iterator it;
 
     it = sc.args.find("Value");
     if (it == sc.args.end() || it->second.empty()) {
         return UPNP_E_INVALID_PARAM;
     }
-    if (it->second[0] == 'F' || it->second[0] == '0') {
-        LOGDEB("OHProduct::setStandby-> standby off" << endl);
-    } else if (it->second[0] == 'T' || it->second[0] == '1') {
-        LOGDEB("OHProduct::setStandby-> standby on" << endl);
-    } else {
-        return UPNP_E_INVALID_PARAM;
-    }
-    m_dev->loopWakeup();
-    return UPNP_E_SUCCESS;
-}
-
-int OHProduct::sourceCount(const SoapArgs& sc, SoapData& data)
-{
-    LOGDEB("OHProduct::sourceCount" << endl);
-    data.addarg("Value", "1");
-    return UPNP_E_SUCCESS;
-}
-
-int OHProduct::sourceXML(const SoapArgs& sc, SoapData& data)
-{
-    LOGDEB("OHProduct::sourceXML" << endl);
-    data.addarg("Value", csxml);
-    return UPNP_E_SUCCESS;
-}
-
-int OHProduct::sourceIndex(const SoapArgs& sc, SoapData& data)
-{
-    LOGDEB("OHProduct::sourceIndex" << endl);
-    data.addarg("Value", "0");
-    return UPNP_E_SUCCESS;
-}
-
-int OHProduct::setSourceIndex(const SoapArgs& sc, SoapData& data)
-{
-    LOGDEB("OHProduct::setSourceIndex" << endl);
-    map<string, string>::const_iterator it;
-
-    it = sc.args.find("Value");
-    if (it == sc.args.end() || it->second.empty()) {
-        return UPNP_E_INVALID_PARAM;
-    }
-    LOGDEB("OHProduct::setSourceIndex: " << it->second << endl);
-    m_dev->loopWakeup();
-    return UPNP_E_SUCCESS;
-}
-
-int OHProduct::setSourceIndexByName(const SoapArgs& sc, SoapData& data)
-{
-    LOGDEB("OHProduct::setSourceIndexByName" << endl);
-    map<string, string>::const_iterator it;
-
-    it = sc.args.find("Value");
-    if (it == sc.args.end() || it->second.empty()) {
-        return UPNP_E_INVALID_PARAM;
-    }
     LOGDEB("OHProduct::setSourceIndexByName: " << it->second << endl);
     m_dev->loopWakeup();
     return UPNP_E_SUCCESS;
@@ -241,15 +228,12 @@
 int OHProduct::source(const SoapArgs& sc, SoapData& data)
 {
     LOGDEB("OHProduct::source" << endl);
-    map<string, string>::const_iterator it;
-
-    it = sc.args.find("Index");
-    if (it == sc.args.end() || it->second.empty()) {
-        return UPNP_E_INVALID_PARAM;
-    }
-    string sindex(it->second);
+    int sindex;
+    if (!sc.getInt("Index", &sindex)) {
+        return UPNP_E_INVALID_PARAM;
+    }
     LOGDEB("OHProduct::setSourceIndex: " << sindex << endl);
-    if (sindex.compare("0")) {
+    if (sindex != 0) {
         return UPNP_E_INVALID_PARAM;
     }
     data.addarg("SystemName", "Default");