Blame view

buildroot/buildroot-2016.08.1/package/ushare/0001-compile-fixes.patch 5.4 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
  Patch nixed from OpenWRT svn to fix build breakage.
  
  Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  
  --- a/src/cds.c
  +++ b/src/cds.c
  @@ -20,6 +20,8 @@
    */
   
   #include <stdlib.h>
  +#include <stdio.h>
  +#include <string.h>
   #include <upnp/upnp.h>
   #include <upnp/upnptools.h>
   
  --- a/src/http.c
  +++ b/src/http.c
  @@ -25,6 +25,7 @@
   #include <errno.h>
   #include <stdio.h>
   #include <stdlib.h>
  +#include <string.h>
   #include <unistd.h>
   #include <errno.h>
   
  @@ -77,8 +78,7 @@ set_info_file (struct File_Info *info, c
     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 +197,7 @@ get_file_memory (const char *fullpath, c
     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 +250,7 @@ http_open (const char *filename, enum Up
     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 +284,7 @@ http_read (UpnpWebFileHandle fh, char *b
     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 +293,7 @@ http_write (UpnpWebFileHandle fh __attri
     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 +367,7 @@ http_seek (UpnpWebFileHandle fh, off_t o
     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 +397,3 @@ http_close (UpnpWebFileHandle fh)
   
     return 0;
   }
  -
  -struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
  -  {
  -    http_get_info,
  -    http_open,
  -    http_read,
  -    http_write,
  -    http_seek,
  -    http_close
  -  };
  --- a/src/http.h
  +++ b/src/http.h
  @@ -25,6 +25,18 @@
   #include <upnp/upnp.h>
   #include <upnp/upnptools.h>
   
  -struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
  +int http_get_info (const char *filename, struct File_Info *info);
  +
  +UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
  +
  +int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
  +
  +int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
  +
  +int http_write (UpnpWebFileHandle fh __attribute__((unused)),
  +	char *buf __attribute__((unused)),
  +	size_t buflen __attribute__((unused)));
  +
  +int http_close (UpnpWebFileHandle fh);
   
   #endif /* _HTTP_H_ */
  --- a/src/ushare.c
  +++ b/src/ushare.c
  @@ -188,7 +188,7 @@ handle_action_request (struct Upnp_Actio
     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,13 +348,23 @@ init_upnp (struct ushare_t *ut)
   
     UpnpEnableWebserver (TRUE);
   
  -  res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
  -  if (res != UPNP_E_SUCCESS)
  -  {
  -    log_error (_("Cannot set virtual directory callbacks
  "));
  -    free (description);
  -    return -1;
  -  }
  +#define upnp_set_callback(cb, func) \
  +  do {                                                            \
  +    res = UpnpVirtualDir_set_##cb##Callback(func);                \
  +    if (res != UPNP_E_SUCCESS)                                    \
  +    {                                                             \
  +      log_error (_("Cannot set virtual directory callbacks
  "));  \
  +      free (description);                                         \
  +      return -1;                                                  \
  +    }                                                             \
  +  } while(0)
  +
  +  upnp_set_callback(GetInfo, http_get_info);
  +  upnp_set_callback(Open,    http_open);
  +  upnp_set_callback(Read,    http_read);
  +  upnp_set_callback(Seek,    http_seek);
  +  upnp_set_callback(Write,   http_write);
  +  upnp_set_callback(Close,   http_close);
   
     res = UpnpAddVirtualDir (VIRTUAL_DIR);
     if (res != UPNP_E_SUCCESS)
  --- a/src/cms.c
  +++ b/src/cms.c
  @@ -20,6 +20,8 @@
    */
   
   #include <stdlib.h>
  +#include <stdio.h>
  +#include <string.h>
   #include <upnp/upnp.h>
   #include <upnp/upnptools.h>
   
  --- a/src/mime.c
  +++ b/src/mime.c
  @@ -20,6 +20,7 @@
    */
   
   #include <stdlib.h>
  +#include <stdio.h>
   #include <string.h>
   
   #include "mime.h"
  --- a/src/presentation.c
  +++ b/src/presentation.c
  @@ -19,6 +19,8 @@
    */
   
   #include <stdlib.h>
  +#include <stdio.h>
  +#include <string.h>
   
   #if HAVE_LANGINFO_CODESET
   # include <langinfo.h>
  --- a/src/services.c
  +++ b/src/services.c
  @@ -20,6 +20,8 @@
    */
   
   #include <stdlib.h>
  +#include <stdio.h>
  +#include <string.h>
   #include <upnp/upnp.h>
   #include <upnp/upnptools.h>