ObjFW  Check-in [cd9635897c]

Overview
Comment:resolver.m: Cast h_addr_list to char **

On AmigaOS 4, this is __BYTE **, causing a warning without the cast.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cd9635897c7c76848dff589a38383ecdf0e33fc68e93830a59bcc1ec19af1ec0
User & Date: js on 2018-03-10 19:41:25
Other Links: manifest | tags
Context
2018-03-10
19:43
socket.h: Provide sockaddr_storage on AmigaOS 4 check-in: 3924c79b73 user: js tags: trunk
19:41
resolver.m: Cast h_addr_list to char ** check-in: cd9635897c user: js tags: trunk
19:31
platform.h: Add AmigaOS 4 check-in: 2d0da271bf user: js tags: trunk
Changes

Modified src/resolver.m from [7ddc4e62c4] to [fa7a0544ce].

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		if ((he = gethostbyname((const void *)[host UTF8String])) ==
		    NULL || he->h_addrtype != AF_INET)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host
					error: h_errno];

		count = 0;
		for (ip = he->h_addr_list; *ip != NULL; ip++)
			count++;

		if (count == 0)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host];

		if ((ret = calloc(count + 1, sizeof(*ret))) == NULL)







|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		if ((he = gethostbyname((const void *)[host UTF8String])) ==
		    NULL || he->h_addrtype != AF_INET)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host
					error: h_errno];

		count = 0;
		for (ip = (char **)he->h_addr_list; *ip != NULL; ip++)
			count++;

		if (count == 0)
			@throw [OFAddressTranslationFailedException
			    exceptionWithHost: host];

		if ((ret = calloc(count + 1, sizeof(*ret))) == NULL)
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
			free(ret);
			free(results);
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: count * sizeof(*addrs)];
		}

		for (retIter = ret, resultsIter = results, addrsIter = addrs,
		    ip = he->h_addr_list; *ip != NULL;
		    retIter++, resultsIter++, addrsIter++, ip++) {
			addrsIter->sin_family = he->h_addrtype;
			addrsIter->sin_port = OF_BSWAP16_IF_LE(port);

			if ((size_t)he->h_length >
			    sizeof(addrsIter->sin_addr.s_addr))
				@throw [OFOutOfRangeException exception];







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
			free(ret);
			free(results);
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: count * sizeof(*addrs)];
		}

		for (retIter = ret, resultsIter = results, addrsIter = addrs,
		    ip = (char **)he->h_addr_list; *ip != NULL;
		    retIter++, resultsIter++, addrsIter++, ip++) {
			addrsIter->sin_family = he->h_addrtype;
			addrsIter->sin_port = OF_BSWAP16_IF_LE(port);

			if ((size_t)he->h_length >
			    sizeof(addrsIter->sin_addr.s_addr))
				@throw [OFOutOfRangeException exception];