libasplib: add url to gcc bug report
[buildroot-gz.git] / package / nuttcp / 0001-susv3-legacy.patch
blob9a215f8a8683c9db58a1b837d302c5751977a89d
1 [PATCH] Replace susv3 legacy function with modern equivalents
3 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
4 ---
5 nuttcp-6.1.2.c | 90 ++++++++++++++++++++++++++++-----------------------------
6 1 file changed, 45 insertions(+), 45 deletions(-)
8 Index: nuttcp-6.1.2/nuttcp-6.1.2.c
9 ===================================================================
10 --- nuttcp-6.1.2.orig/nuttcp-6.1.2.c
11 +++ nuttcp-6.1.2/nuttcp-6.1.2.c
12 @@ -1925,11 +1925,11 @@
13 if (udp && !haverateopt)
14 rate = DEFAULT_UDP_RATE;
16 - bzero((char *)&frominet, sizeof(frominet));
17 - bzero((char *)&clientaddr, sizeof(clientaddr));
18 + memset((char *)&frominet, 0, sizeof(frominet));
19 + memset((char *)&clientaddr, 0, sizeof(clientaddr));
21 #ifdef AF_INET6
22 - bzero((char *)&clientaddr6, sizeof(clientaddr6));
23 + memset((char *)&clientaddr6, 0, sizeof(clientaddr6));
24 clientscope6 = 0;
25 #endif
27 @@ -1985,7 +1985,7 @@
30 while (stream_idx <= nstream) {
31 - bzero(&hints, sizeof(hints));
32 + memset(&hints, 0, sizeof(hints));
33 res[stream_idx] = NULL;
34 if (explicitaf) hints.ai_family = af;
35 if ((cp2 = strchr(cp1, '/'))) {
36 @@ -3013,12 +3013,12 @@
37 if ((stream_idx > 0) && skip_data)
38 break;
40 - bzero((char *)&sinme[stream_idx], sizeof(sinme[stream_idx]));
41 - bzero((char *)&sinhim[stream_idx], sizeof(sinhim[stream_idx]));
42 + memset((char *)&sinme[stream_idx], 0, sizeof(sinme[stream_idx]));
43 + memset((char *)&sinhim[stream_idx], 0, sizeof(sinhim[stream_idx]));
45 #ifdef AF_INET6
46 - bzero((char *)&sinme6[stream_idx], sizeof(sinme6[stream_idx]));
47 - bzero((char *)&sinhim6[stream_idx], sizeof(sinhim6[stream_idx]));
48 + memset((char *)&sinme6[stream_idx], 0, sizeof(sinme6[stream_idx]));
49 + memset((char *)&sinhim6[stream_idx], 0, sizeof(sinhim6[stream_idx]));
50 #endif
52 if (((trans && !reverse) && (stream_idx > 0)) ||
53 @@ -3028,15 +3028,15 @@
54 if (client) {
55 if (af == AF_INET) {
56 sinhim[stream_idx].sin_family = af;
57 - bcopy((char *)&(((struct sockaddr_in *)res[stream_idx]->ai_addr)->sin_addr),
58 - (char *)&sinhim[stream_idx].sin_addr.s_addr,
59 + memcpy((char *)&sinhim[stream_idx].sin_addr.s_addr,
60 + (char *)&(((struct sockaddr_in *)res[stream_idx]->ai_addr)->sin_addr),
61 sizeof(sinhim[stream_idx].sin_addr.s_addr));
63 #ifdef AF_INET6
64 else if (af == AF_INET6) {
65 sinhim6[stream_idx].sin6_family = af;
66 - bcopy((char *)&(((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_addr),
67 - (char *)&sinhim6[stream_idx].sin6_addr.s6_addr,
68 + memcpy((char *)&sinhim6[stream_idx].sin6_addr.s6_addr,
69 + (char *)&(((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_addr),
70 sizeof(sinhim6[stream_idx].sin6_addr.s6_addr));
71 sinhim6[stream_idx].sin6_scope_id = ((struct sockaddr_in6 *)res[stream_idx]->ai_addr)->sin6_scope_id;
73 @@ -3113,8 +3113,8 @@
74 * to the multicast group
76 if (af == AF_INET) {
77 - bcopy((char *)&sinhim[1].sin_addr.s_addr,
78 - (char *)&save_sinhim.sin_addr.s_addr,
79 + memcpy((char *)&save_sinhim.sin_addr.s_addr,
80 + (char *)&sinhim[1].sin_addr.s_addr,
81 sizeof(struct in_addr));
82 if (!client && (irvers >= 50505)) {
83 struct sockaddr_in peer;
84 @@ -3124,8 +3124,8 @@
85 &peerlen) < 0) {
86 err("getpeername");
88 - bcopy((char *)&peer.sin_addr.s_addr,
89 - (char *)&sinhim[1].sin_addr.s_addr,
90 + memcpy((char *)&sinhim[1].sin_addr.s_addr,
91 + (char *)&peer.sin_addr.s_addr,
92 sizeof(struct in_addr));
94 else {
95 @@ -3136,8 +3136,8 @@
96 &melen) < 0) {
97 err("getsockname");
99 - bcopy((char *)&me.sin_addr.s_addr,
100 - (char *)&sinhim[1].sin_addr.s_addr,
101 + memcpy((char *)&sinhim[1].sin_addr.s_addr,
102 + (char *)&me.sin_addr.s_addr,
103 sizeof(struct in_addr));
105 sinhim[1].sin_addr.s_addr &=
106 @@ -4197,13 +4197,13 @@
107 &melen) < 0) {
108 err("getsockname");
110 - bcopy((char *)&me.sin_addr.s_addr,
111 - (char *)&mc_group.imr_multiaddr.s_addr,
112 + memcpy((char *)&mc_group.imr_multiaddr.s_addr,
113 + (char *)&me.sin_addr.s_addr,
114 sizeof(struct in_addr));
116 else {
117 - bcopy((char *)&peer.sin_addr.s_addr,
118 - (char *)&mc_group.imr_multiaddr.s_addr,
119 + memcpy((char *)&mc_group.imr_multiaddr.s_addr,
120 + (char *)&peer.sin_addr.s_addr,
121 sizeof(struct in_addr));
123 mc_group.imr_multiaddr.s_addr &= htonl(0xFFFFFF);
124 @@ -4330,12 +4330,12 @@
125 if(udp) {
126 strcpy(buf, "BOD0");
127 if (multicast) {
128 - bcopy((char *)&sinhim[1].sin_addr.s_addr,
129 - (char *)&save_mc.sin_addr.s_addr,
130 - sizeof(struct in_addr));
131 - bcopy((char *)&save_sinhim.sin_addr.s_addr,
132 + memcpy((char *)&save_mc.sin_addr.s_addr,
133 (char *)&sinhim[1].sin_addr.s_addr,
134 sizeof(struct in_addr));
135 + memcpy((char *)&sinhim[1].sin_addr.s_addr,
136 + (char *)&save_sinhim.sin_addr.s_addr,
137 + sizeof(struct in_addr));
139 (void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr start */
140 if (two_bod) {
141 @@ -4344,8 +4344,8 @@
142 (void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr start */
144 if (multicast) {
145 - bcopy((char *)&save_mc.sin_addr.s_addr,
146 - (char *)&sinhim[1].sin_addr.s_addr,
147 + memcpy((char *)&sinhim[1].sin_addr.s_addr,
148 + (char *)&save_mc.sin_addr.s_addr,
149 sizeof(struct in_addr));
151 if (timeout)
152 @@ -4361,7 +4361,7 @@
153 fflush(stdout);
155 if (udplossinfo)
156 - bcopy(&nbytes, buf + 24, 8);
157 + memcpy(buf + 24, &nbytes, 8);
158 if (!udp && interval && !(format & NORETRANS) &&
159 ((retransinfo == 1) ||
160 ((retransinfo >= 2) &&
161 @@ -4372,13 +4372,13 @@
162 tmp = 0x5254524Eu; /* "RTRN" */
163 else
164 tmp = 0x48525452u; /* "HRTR" */
165 - bcopy(&nretrans, buf + 24, 4);
166 - bcopy(&tmp, buf + 28, 4);
167 + memcpy(buf + 24, &nretrans, 4);
168 + memcpy(buf + 28, &tmp, 4);
170 else {
171 send_retrans = 0;
172 if (!udp)
173 - bzero(buf + 24, 8);
174 + memset(buf + 24, 0, 8);
176 if (nbuf == INT_MAX)
177 nbuf = ULLONG_MAX;
178 @@ -4423,12 +4423,12 @@
179 nbytes += buflen;
180 cnt = 0;
181 if (udplossinfo)
182 - bcopy(&nbytes, buf + 24, 8);
183 + memcpy(buf + 24, &nbytes, 8);
184 if (send_retrans) {
185 nretrans = get_retrans(
186 fd[stream_idx + 1]);
187 nretrans -= iretrans;
188 - bcopy(&nretrans, buf + 24, 4);
189 + memcpy(buf + 24, &nretrans, 4);
191 stream_idx++;
192 stream_idx = stream_idx % nstream;
193 @@ -4523,8 +4523,8 @@
194 nbytes += cnt;
195 if(udp) {
196 if (multicast)
197 - bcopy((char *)&save_sinhim.sin_addr.s_addr,
198 - (char *)&sinhim[1].sin_addr.s_addr,
199 + memcpy((char *)&sinhim[1].sin_addr.s_addr,
200 + (char *)&save_sinhim.sin_addr.s_addr,
201 sizeof(struct in_addr));
202 strcpy(buf, "EOD0");
203 (void)Nwrite( fd[stream_idx + 1], buf, 4 ); /* rcvr end */
204 @@ -4532,7 +4532,7 @@
205 } else {
206 first_read = 1;
207 need_swap = 0;
208 - bzero(buf + 24, 8);
209 + memset(buf + 24, 0, 8);
210 if (udp) {
211 ntbytesc = 0;
212 got_eod0 = 0;
213 @@ -4584,7 +4584,7 @@
214 * goes off right here */
215 if (udplossinfo) {
216 if (first_read) {
217 - bcopy(buf + 24, &ntbytesc,
218 + memcpy(&ntbytesc, buf + 24,
220 first_read = 0;
221 if (ntbytesc > 0x100000000ull)
222 @@ -4598,7 +4598,7 @@
225 if (!need_swap)
226 - bcopy(buf + 24, &ntbytesc,
227 + memcpy(&ntbytesc, buf + 24,
229 else {
230 cp1 = (char *)&ntbytesc;
231 @@ -4627,8 +4627,8 @@
232 uint32_t tmp;
234 first_read = 0;
235 - bcopy(buf + 24, &nretrans, 4);
236 - bcopy(buf + 28, &tmp, 4);
237 + memcpy(&nretrans, buf + 24, 4);
238 + memcpy(&tmp, buf + 28, 4);
239 if (tmp == 0x5254524Eu) {
240 /* "RTRN" */
241 retransinfo = 1;
242 @@ -4661,7 +4661,7 @@
244 if (read_retrans) {
245 if (!need_swap)
246 - bcopy(buf + 24, &nretrans,
247 + memcpy(&nretrans, buf + 24,
249 else {
250 cp1 = (char *)&nretrans;
251 @@ -5327,10 +5327,10 @@
252 itimer.it_interval.tv_usec = 0;
253 setitimer(ITIMER_REAL, &itimer, 0);
254 signal(SIGALRM, SIG_DFL);
255 - bzero((char *)&frominet, sizeof(frominet));
256 - bzero((char *)&clientaddr, sizeof(clientaddr));
257 + memset((char *)&frominet, 0, sizeof(frominet));
258 + memset((char *)&clientaddr, 0, sizeof(clientaddr));
259 #ifdef AF_INET6
260 - bzero((char *)&clientaddr6, sizeof(clientaddr));
261 + memset((char *)&clientaddr6, 0, sizeof(clientaddr));
262 clientscope6 = 0;
263 #endif
264 cput = 0.000001;