Control: tag -1 + patch

Hello,

the patch below makes silverjuke compilable against both libupnp6 and
libupnp10. I only compile tested it though.

Best regards
Uwe

diff --git a/debian/control b/debian/control
index b71ee383d90e..7af48f007634 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Dr. Tobias Quathamer <to...@debian.org>
 Build-Depends: debhelper (>= 9), dh-autoreconf, zlib1g-dev,
  libgl1-mesa-dev, libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev,
- libsqlite3-dev, libwxgtk3.0-dev, libupnp-dev, python3-docutils
+ libsqlite3-dev, libwxgtk3.0-dev, libupnp-dev (>= 1:1.6.24~), python3-docutils
 Standards-Version: 3.9.8
 Homepage: http://www.silverjuke.net/
 Vcs-Browser: https://anonscm.debian.org/cgit/users/toddy/debian/silverjuke.git
diff --git a/debian/patches/port-to-libupnp1.8.patch 
b/debian/patches/port-to-libupnp1.8.patch
new file mode 100644
index 000000000000..09bd8631cbab
--- /dev/null
+++ b/debian/patches/port-to-libupnp1.8.patch
@@ -0,0 +1,51 @@
+--- a/src/sjmodules/scanner/upnp_scanner.cpp
++++ b/src/sjmodules/scanner/upnp_scanner.cpp
+@@ -553,7 +553,7 @@
+ }
+ 
+ 
+-static int client_event_handler(Upnp_EventType eventType, void* p_event, 
void* user_data)
++static int client_event_handler(Upnp_EventType eventType, const void* 
p_event, void* user_data)
+ {
+       // CAVE: We may be in _any_ thread here!
+ 
+@@ -565,21 +565,21 @@
+               case UPNP_DISCOVERY_SEARCH_RESULT:       // normal search 
result, we may be more of this
+                       {
+                               // get device structure
+-                              struct Upnp_Discovery* discoverEvent = (struct 
Upnp_Discovery*)p_event;
++                              UpnpDiscovery* discoverEvent = 
(UpnpDiscovery*)p_event;
+ 
+                               IXML_Document* p_description_doc = NULL;
+-                              int error = 
UpnpDownloadXmlDoc(discoverEvent->Location, &p_description_doc);
++                              int error = 
UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(discoverEvent), 
&p_description_doc);
+                               if( error != UPNP_E_SUCCESS ) {
+                                       // happens eg. with DroidUPnP, error 
-207, TIMEOUT
+                                       //         or with the Samsung Laser 
conntected via USB to Windows 10 - error -119, UPNP_E_BAD_HTTPMSG (malformed 
header received from remote host)
+                                       // we log these errors as minor errors 
(info) to avoid popping up an error box.
+-                                      g_upnpModule->LogMinorUpnpError("Cannot 
download device description", error, discoverEvent->Location);
++                                      g_upnpModule->LogMinorUpnpError("Cannot 
download device description", error, 
UpnpDiscovery_get_Location_cstr(discoverEvent));
+                                       return error;
+                               }
+ 
+                               {
+                                       wxCriticalSectionLocker 
locker(this_->m_mediaServerCritical);
+-                                      
parseDeviceDescription(p_description_doc, discoverEvent->Location, this_, 
&this_->m_mediaServerList);
++                                      
parseDeviceDescription(p_description_doc, 
UpnpDiscovery_get_Location_cstr(discoverEvent), this_, 
&this_->m_mediaServerList);
+                               }
+ 
+                               ixmlDocument_free(p_description_doc);
+@@ -637,6 +637,13 @@
+       return UPNP_E_SUCCESS;
+ }
+ 
++#if UPNP_VERSION < 10800
++/* needed for compatibility with libupnp1.6 */
++static int client_event_handler(Upnp_EventType eventType, void* p_event, 
void* user_data)
++{
++      return client_event_handler(eventType, (const void *)p_event, 
user_data);
++}
++#endif
+ 
+ bool SjUpnpScannerModule::init_client()
+ {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 000000000000..3f96cdd3b150
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+port-to-libupnp1.8.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to