Use debhelper-compat instead of d/compat
[osspd.git] / debian / patches / GIT-fix-compiler-warnings.patch
1 From 37eb730a452f0ded2ed1c174feb438e3df041581 Mon Sep 17 00:00:00 2001
2 From: Miklos Szeredi <mszeredi@suse.cz>
3 Date: Fri, 11 Nov 2011 14:19:32 +0100
4 Subject: [PATCH] fix compiler warnings
5
6 ---
7  ossp-padsp.c |  3 ---
8  osspd.c      | 75 ++++++++++++++++++++++++++++++----------------------
9  2 files changed, 44 insertions(+), 34 deletions(-)
10
11 diff --git a/ossp-padsp.c b/ossp-padsp.c
12 index 1871f5b..3143960 100644
13 --- a/ossp-padsp.c
14 +++ b/ossp-padsp.c
15 @@ -972,16 +972,13 @@ static void do_mmap_read(size_t bytes)
16  
17  static void stream_rw_callback(pa_stream *s, size_t length, void *userdata)
18  {
19 -       int dir;
20         size_t size;
21  
22         if (s == stream[PLAY]) {
23 -               dir = PLAY;
24                 size = pa_stream_writable_size(s);
25                 if (mmap_map[PLAY])
26                         do_mmap_write(size);
27         } else if (s == stream[REC]) {
28 -               dir = REC;
29                 size = pa_stream_readable_size(s);
30                 if (mmap_map[REC])
31                         do_mmap_read(size);
32 diff --git a/osspd.c b/osspd.c
33 index df1cfc4..4be1ad5 100644
34 --- a/osspd.c
35 +++ b/osspd.c
36 @@ -469,15 +469,6 @@ static int ioctl_prep_uarg(fuse_req_t req, void *in, size_t in_sz, void *out,
37                 return;                                                 \
38  } while (0)
39  
40 -#define IOCTL_RETURN(result, outp) do {                                        \
41 -       if ((outp) != NULL)                                             \
42 -               fuse_reply_ioctl(req, result, (outp), sizeof(*(outp))); \
43 -       else                                                            \
44 -               fuse_reply_ioctl(req, result, NULL, 0);                 \
45 -       return;                                                         \
46 -} while (0)
47 -
48 -
49  /***************************************************************************
50   * Mixer implementation
51   */
52 @@ -709,7 +700,8 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
53                 strncpy(info.id, id, sizeof(info.id) - 1);
54                 strncpy(info.name, name, sizeof(info.name) - 1);
55                 info.modify_counter = mixer->modify_counter;
56 -               IOCTL_RETURN(0, &info);
57 +               fuse_reply_ioctl(req, 0, &info, sizeof(info));
58 +               break;
59         }
60  
61         case SOUND_OLD_MIXER_INFO: {
62 @@ -718,7 +710,8 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
63                 PREP_UARG(NULL, &info);
64                 strncpy(info.id, id, sizeof(info.id) - 1);
65                 strncpy(info.name, name, sizeof(info.name) - 1);
66 -               IOCTL_RETURN(0, &info);
67 +               fuse_reply_ioctl(req, 0, &info, sizeof(info));
68 +               break;
69         }
70  
71         case OSS_GETVERSION:
72 @@ -737,16 +730,16 @@ static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
73                 goto puti;
74         puti:
75                 PREP_UARG(NULL, &i);
76 -               IOCTL_RETURN(0, &i);
77 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
78 +               break;
79  
80         case SOUND_MIXER_WRITE_RECSRC:
81 -               IOCTL_RETURN(0, NULL);
82 +               fuse_reply_ioctl(req, 0, NULL, 0);
83 +               break;
84  
85         default:
86                 *not_minep = 1;
87 -               return;
88         }
89 -       assert(0);
90  }
91  
92  static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
93 @@ -787,7 +780,8 @@ static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
94                 break;
95         default:
96                 i = 0;
97 -               IOCTL_RETURN(0, &i);
98 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
99 +               return;
100         }
101  
102         init_mixer_cmd(&mxcmd, mixer);
103 @@ -837,7 +831,12 @@ static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer,
104         finish_mixer_cmd(&mxcmd);
105         free(osa);
106  
107 -       IOCTL_RETURN(0, out_bufsz ? &mxcmd.rvol : NULL);
108 +       if (out_bufsz)
109 +               fuse_reply_ioctl(req, 0, &mxcmd.rvol, sizeof(mxcmd.rvol));
110 +       else
111 +               fuse_reply_ioctl(req, 0, NULL, 0);
112 +
113 +       return;
114  
115  err:
116         fuse_reply_err(req, -rc);
117 @@ -1510,7 +1509,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
118         case OSS_GETVERSION:
119                 i = SNDRV_OSS_VERSION;
120                 PREP_UARG(NULL, &i);
121 -               IOCTL_RETURN(0, &i);
122 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
123 +               break;
124  
125         case SNDCTL_DSP_GETCAPS:
126                 i = DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER |
127 @@ -1519,12 +1519,14 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
128  #endif
129                         DSP_CAP_MULTI;
130                 PREP_UARG(NULL, &i);
131 -               IOCTL_RETURN(0, &i);
132 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
133 +               break;
134  
135         case SNDCTL_DSP_NONBLOCK:
136                 dsps->nonblock = 1;
137                 ret = 0;
138 -               IOCTL_RETURN(0, NULL);
139 +               fuse_reply_ioctl(req, 0, NULL, 0);
140 +               break;
141  
142         case SNDCTL_DSP_RESET:          op = OSSP_DSP_RESET;            goto nd;
143         case SNDCTL_DSP_SYNC:           op = OSSP_DSP_SYNC;             goto nd;
144 @@ -1533,7 +1535,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
145                 ret = exec_simple_cmd(&dsps->os, op, NULL, NULL);
146                 if (ret)
147                         goto err;
148 -               IOCTL_RETURN(0, NULL);
149 +               fuse_reply_ioctl(req, 0, NULL, 0);
150 +               break;
151  
152         case SOUND_PCM_READ_RATE:       op = OSSP_DSP_GET_RATE;         goto ri;
153         case SOUND_PCM_READ_BITS:       op = OSSP_DSP_GET_FORMAT;       goto ri;
154 @@ -1546,7 +1549,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
155                 ret = exec_simple_cmd(&dsps->os, op, NULL, &i);
156                 if (ret)
157                         goto err;
158 -               IOCTL_RETURN(0, &i);
159 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
160 +               break;
161  
162         case SNDCTL_DSP_SPEED:          op = OSSP_DSP_SET_RATE;         goto wi;
163         case SNDCTL_DSP_SETFMT:         op = OSSP_DSP_SET_FORMAT;       goto wi;
164 @@ -1557,7 +1561,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
165                 ret = exec_simple_cmd(&dsps->os, op, &i, &i);
166                 if (ret)
167                         goto err;
168 -               IOCTL_RETURN(0, &i);
169 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
170 +               break;
171  
172         case SNDCTL_DSP_STEREO:
173                 PREP_UARG(NULL, &i);
174 @@ -1566,7 +1571,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
175                 i--;
176                 if (ret)
177                         goto err;
178 -               IOCTL_RETURN(0, &i);
179 +               fuse_reply_ioctl(req, 0, &i, sizeof(i));
180 +               break;
181  
182         case SNDCTL_DSP_SETFRAGMENT:
183                 PREP_UARG(&i, NULL);
184 @@ -1574,7 +1580,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
185                                       OSSP_DSP_SET_FRAGMENT, &i, NULL);
186                 if (ret)
187                         goto err;
188 -               IOCTL_RETURN(0, NULL);
189 +               fuse_reply_ioctl(req, 0, NULL, 0);
190 +               break;
191  
192         case SNDCTL_DSP_SETTRIGGER:
193                 PREP_UARG(&i, NULL);
194 @@ -1582,7 +1589,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
195                                       OSSP_DSP_SET_TRIGGER, &i, NULL);
196                 if (ret)
197                         goto err;
198 -               IOCTL_RETURN(0, NULL);
199 +               fuse_reply_ioctl(req, 0, NULL, 0);
200 +               break;
201  
202         case SNDCTL_DSP_GETOSPACE:
203         case SNDCTL_DSP_GETISPACE: {
204 @@ -1603,7 +1611,8 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
205                 ret = exec_simple_cmd(&dsps->os, op, NULL, &info);
206                 if (ret)
207                         goto err;
208 -               IOCTL_RETURN(0, &info);
209 +               fuse_reply_ioctl(req, 0, &info, sizeof(info));
210 +               break;
211         }
212  
213         case SNDCTL_DSP_GETOPTR:
214 @@ -1616,14 +1625,16 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
215                 ret = exec_simple_cmd(&dsps->os, op, NULL, &info);
216                 if (ret)
217                         goto err;
218 -               IOCTL_RETURN(0, &info);
219 +               fuse_reply_ioctl(req, 0, &info, sizeof(info));
220 +               break;
221         }
222  
223         case SNDCTL_DSP_GETODELAY:
224                 PREP_UARG(NULL, &i);
225                 i = 0;
226                 ret = exec_simple_cmd(&dsps->os, OSSP_DSP_GET_ODELAY, NULL, &i);
227 -               IOCTL_RETURN(ret, &i);  /* always copy out result, 0 on err */
228 +               fuse_reply_ioctl(req, ret, &i, sizeof(i));      /* always copy out result, 0 on err */
229 +               break;
230  
231         case SOUND_PCM_WRITE_FILTER:
232         case SOUND_PCM_READ_FILTER:
233 @@ -1638,14 +1649,16 @@ static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg,
234         case SNDCTL_DSP_SETSYNCRO:
235         case SNDCTL_DSP_SETDUPLEX:
236         case SNDCTL_DSP_PROFILE:
237 -               IOCTL_RETURN(0, NULL);
238 +               fuse_reply_ioctl(req, 0, NULL, 0);
239 +               break;
240  
241         default:
242                 warn_os(os, "unknown ioctl 0x%x", cmd);
243                 ret = -EINVAL;
244                 goto err;
245         }
246 -       assert(0);      /* control shouldn't reach here */
247 +       return;
248 +
249  err:
250         fuse_reply_err(req, -ret);
251  }