1 Patch nixed from OpenWRT svn to fix build breakage.
3 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
13 #include <upnp/upnp.h>
14 #include <upnp/upnptools.h>
26 @@ -77,8 +78,7 @@ set_info_file (struct File_Info *info, c
27 info->content_type = ixmlCloneDOMString (content_type);
31 -http_get_info (const char *filename, struct File_Info *info)
32 +int http_get_info (const char *filename, struct File_Info *info)
34 extern struct ushare_t *ut;
35 struct upnp_entry_t *entry = NULL;
36 @@ -197,8 +197,7 @@ get_file_memory (const char *fullpath, c
37 return ((UpnpWebFileHandle) file);
40 -static UpnpWebFileHandle
41 -http_open (const char *filename, enum UpnpOpenFileMode mode)
42 +UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode)
44 extern struct ushare_t *ut;
45 struct upnp_entry_t *entry = NULL;
46 @@ -251,8 +250,7 @@ http_open (const char *filename, enum Up
47 return ((UpnpWebFileHandle) file);
51 -http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
52 +int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
54 struct web_file_t *file = (struct web_file_t *) fh;
56 @@ -286,8 +284,7 @@ http_read (UpnpWebFileHandle fh, char *b
61 -http_write (UpnpWebFileHandle fh __attribute__((unused)),
62 +int http_write (UpnpWebFileHandle fh __attribute__((unused)),
63 char *buf __attribute__((unused)),
64 size_t buflen __attribute__((unused)))
66 @@ -296,8 +293,7 @@ http_write (UpnpWebFileHandle fh __attri
71 -http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
72 +int http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
74 struct web_file_t *file = (struct web_file_t *) fh;
76 @@ -371,8 +367,7 @@ http_seek (UpnpWebFileHandle fh, off_t o
81 -http_close (UpnpWebFileHandle fh)
82 +int http_close (UpnpWebFileHandle fh)
84 struct web_file_t *file = (struct web_file_t *) fh;
86 @@ -402,13 +397,3 @@ http_close (UpnpWebFileHandle fh)
91 -struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
103 #include <upnp/upnp.h>
104 #include <upnp/upnptools.h>
106 -struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
107 +int http_get_info (const char *filename, struct File_Info *info);
109 +UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
111 +int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
113 +int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
115 +int http_write (UpnpWebFileHandle fh __attribute__((unused)),
116 + char *buf __attribute__((unused)),
117 + size_t buflen __attribute__((unused)));
119 +int http_close (UpnpWebFileHandle fh);
121 #endif /* _HTTP_H_ */
124 @@ -188,7 +188,7 @@ handle_action_request (struct Upnp_Actio
125 if (strcmp (request->DevUDN + 5, ut->udn))
128 - ip = request->CtrlPtIPAddr.s_addr;
129 + ip = (*(struct sockaddr_in *)&request->CtrlPtIPAddr).sin_addr.s_addr;
131 sprintf (val, "%d.%d.%d.%d",
132 (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
133 @@ -348,13 +348,23 @@ init_upnp (struct ushare_t *ut)
135 UpnpEnableWebserver (TRUE);
137 - res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
138 - if (res != UPNP_E_SUCCESS)
140 - log_error (_("Cannot set virtual directory callbacks\n"));
141 - free (description);
144 +#define upnp_set_callback(cb, func) \
146 + res = UpnpVirtualDir_set_##cb##Callback(func); \
147 + if (res != UPNP_E_SUCCESS) \
149 + log_error (_("Cannot set virtual directory callbacks\n")); \
150 + free (description); \
155 + upnp_set_callback(GetInfo, http_get_info);
156 + upnp_set_callback(Open, http_open);
157 + upnp_set_callback(Read, http_read);
158 + upnp_set_callback(Seek, http_seek);
159 + upnp_set_callback(Write, http_write);
160 + upnp_set_callback(Close, http_close);
162 res = UpnpAddVirtualDir (VIRTUAL_DIR);
163 if (res != UPNP_E_SUCCESS)
172 #include <upnp/upnp.h>
173 #include <upnp/upnptools.h>
185 --- a/src/presentation.c
186 +++ b/src/presentation.c
194 #if HAVE_LANGINFO_CODESET
195 # include <langinfo.h>
204 #include <upnp/upnp.h>
205 #include <upnp/upnptools.h>