Switch to side-by-side view

--- a/libupnpp/upnpplib.cxx
+++ b/libupnpp/upnpplib.cxx
@@ -48,6 +48,12 @@
 
 using namespace std;
 
+#if UPNP_VERSION_MAJOR > 1 || (UPNP_VERSION_MAJOR==1 && UPNP_VERSION_MINOR >= 8)
+#define CBCONST const
+#else
+#define CBCONST 
+#endif
+
 namespace UPnPP {
 
 static LibUPnP *theLib;
@@ -201,15 +207,21 @@
 
 int LibUPnP::setupWebServer(const string& description, UpnpDevice_Handle *dvh)
 {
+    // If we send description as a string (UPNPREG_BUF_DESC), libupnp
+    // wants config_baseURL to be set, and it will serve the edited
+    // description (with URLBase added) from the root directory. Which
+    // is not nice. So we specify it as an URL, pointing to the
+    // version in the vdir: http://myip:myport/somedir/description.xml
+    // This is called from device.cxx where the corresponding right
+    // thing must be done of course.
     int res = UpnpRegisterRootDevice2(
-                  UPNPREG_BUF_DESC,
-                  description.c_str(),
-                  description.size(), /* Desc filename len, ignored */
-                  1, /* config_baseURL */
-                  o_callback, (void *)this, dvh);
+        UPNPREG_URL_DESC, description.c_str(), description.size(), 
+        0, /* config_baseURL */
+        o_callback, (void *)this, dvh);
 
     if (res != UPNP_E_SUCCESS) {
-        LOGERR(errAsString("UpnpRegisterRootDevice2", res) << " description " <<
+        LOGERR("LibUPnP::setupWebServer(): " <<
+               errAsString("UpnpRegisterRootDevice2", res) << " description " <<
                description << endl);
     }
     return res;
@@ -291,7 +303,7 @@
     return os.str();
 }
 
-int LibUPnP::o_callback(Upnp_EventType et, void* evp, void* cookie)
+int LibUPnP::o_callback(Upnp_EventType et, CBCONST void* evp, void* cookie)
 {
     LibUPnP *ulib = (LibUPnP *)cookie;
     if (ulib == 0) {