[ushare] 101-ushare-upnp-build-fix.patch: Fix build against newer libupnp (#715648)

Adam Jackson ajax at fedoraproject.org
Wed Jul 6 13:53:17 UTC 2011


commit f5501bf1acdd43e87161a18dcbe66bb830495382
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jul 6 09:53:07 2011 -0400

    101-ushare-upnp-build-fix.patch: Fix build against newer libupnp (#715648)

 101-ushare-upnp-build-fix.patch |  158 +++++++++++++++++++++++++++++++++++++++
 ushare.spec                     |    7 ++-
 2 files changed, 164 insertions(+), 1 deletions(-)
---
diff --git a/101-ushare-upnp-build-fix.patch b/101-ushare-upnp-build-fix.patch
new file mode 100644
index 0000000..f37fe72
--- /dev/null
+++ b/101-ushare-upnp-build-fix.patch
@@ -0,0 +1,158 @@
+Source: https://dev.openwrt.org/raw-attachment/ticket/8296/101-ushare-upnp-build-fix.patch
+
+diff -wbBur ushare-1.1a/src/http.c ushare-1.1a.my/src/http.c
+--- ushare-1.1a/src/http.c	2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/http.c	2010-10-29 11:13:07.000000000 +0000
+@@ -77,8 +77,7 @@
+   info->content_type = ixmlCloneDOMString (content_type);
+ }
+ 
+-static int
+-http_get_info (const char *filename, struct File_Info *info)
++int http_get_info (const char *filename, struct File_Info *info)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -197,8 +196,7 @@
+   return ((UpnpWebFileHandle) file);
+ }
+ 
+-static UpnpWebFileHandle
+-http_open (const char *filename, enum UpnpOpenFileMode mode)
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -251,8 +249,7 @@
+   return ((UpnpWebFileHandle) file);
+ }
+ 
+-static int
+-http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   ssize_t len = -1;
+@@ -286,8 +283,7 @@
+   return len;
+ }
+ 
+-static int
+-http_write (UpnpWebFileHandle fh __attribute__((unused)),
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
+             char *buf __attribute__((unused)),
+             size_t buflen __attribute__((unused)))
+ {
+@@ -296,8 +292,7 @@
+   return 0;
+ }
+ 
+-static int
+-http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   off_t newpos = -1;
+@@ -371,8 +366,7 @@
+   return 0;
+ }
+ 
+-static int
+-http_close (UpnpWebFileHandle fh)
++int http_close (UpnpWebFileHandle fh)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+ 
+@@ -402,13 +396,3 @@
+ 
+   return 0;
+ }
+-
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
+-  {
+-    http_get_info,
+-    http_open,
+-    http_read,
+-    http_write,
+-    http_seek,
+-    http_close
+-  };
+diff -wbBur ushare-1.1a/src/http.h ushare-1.1a.my/src/http.h
+--- ushare-1.1a/src/http.h	2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/http.h	2010-10-29 11:13:11.000000000 +0000
+@@ -25,6 +25,13 @@
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
+ 
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
++int http_close (UpnpWebFileHandle fh);
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
++            char *buf __attribute__((unused)),
++            size_t buflen __attribute__((unused)));
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
++int http_get_info (const char *filename, struct File_Info *info);
+ 
+ #endif /* _HTTP_H_ */
+diff -wbBur ushare-1.1a/src/ushare.c ushare-1.1a.my/src/ushare.c
+--- ushare-1.1a/src/ushare.c	2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/ushare.c	2010-10-29 11:17:45.000000000 +0000
+@@ -188,7 +188,7 @@
+   if (strcmp (request->DevUDN + 5, ut->udn))
+     return;
+ 
+-  ip = request->CtrlPtIPAddr.s_addr;
++  ip = (*(struct sockaddr_in*)&request->CtrlPtIPAddr).sin_addr.s_addr;
+   ip = ntohl (ip);
+   sprintf (val, "%d.%d.%d.%d",
+            (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
+@@ -348,7 +348,47 @@
+ 
+   UpnpEnableWebserver (TRUE);
+ 
+-  res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
++  res = UpnpVirtualDir_set_WriteCallback(http_write);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_("Cannot set virtual directory callbacks\n"));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_GetInfoCallback(http_get_info);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_("Cannot set virtual directory callbacks\n"));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_ReadCallback(http_read);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_("Cannot set virtual directory callbacks\n"));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_OpenCallback(http_open);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_("Cannot set virtual directory callbacks\n"));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_SeekCallback(http_seek);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_("Cannot set virtual directory callbacks\n"));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_CloseCallback(http_close);
+   if (res != UPNP_E_SUCCESS)
+   {
+     log_error (_("Cannot set virtual directory callbacks\n"));
diff --git a/ushare.spec b/ushare.spec
index ee7e6de..9ff9295 100644
--- a/ushare.spec
+++ b/ushare.spec
@@ -1,7 +1,7 @@
 Summary: UPnP (TM) A/V Media Server
 Name: ushare
 Version: 1.1a
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: LGPLv2+
 Group: Applications/Multimedia
 URL: http://ushare.geexbox.org/
@@ -10,6 +10,7 @@ Source: http://ushare.geexbox.org/releases/%{name}-%{version}.tar.bz2
 Source1:ushare.init
 Patch0: ushare-conf.patch
 Patch1: ushare-error.patch
+Patch2: 101-ushare-upnp-build-fix.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: libupnp-devel, pkgconfig
@@ -29,6 +30,7 @@ of libupnp to stream the files to clients.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 iconv -f ISO_8859-1 -t UTF-8 AUTHORS --output AUTHORS.utf8
 cp -af AUTHORS.utf8 AUTHORS
 
@@ -78,6 +80,9 @@ fi
 %attr(770,ushare,ushare) %dir %{_var}/lib/ushare/
 
 %changelog
+* Wed Jul 06 2011 Adam Jackson <ajax at redhat.com> 1.1a-8
+- 101-ushare-upnp-build-fix.patch: Fix build against newer libupnp (#715648)
+
 * Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1a-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list