Differences From Artifact [e5254d8f80]:
- File src/resolver.m — part of check-in [d07c56a8bb] at 2017-04-02 01:06:35 on branch trunk — Add OF_CONSTRUCTOR() / OF_DESTRUCTOR() (user: js, size: 8687) [annotate] [blame] [check-ins using]
To Artifact [1e35fdb00e]:
- File
src/resolver.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 8694) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
49 50 51 52 53 54 55 | OF_CONSTRUCTOR() { if (!of_mutex_new(&mutex)) @throw [OFInitializationFailedException exception]; } #endif | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | OF_CONSTRUCTOR() { if (!of_mutex_new(&mutex)) @throw [OFInitializationFailedException exception]; } #endif of_resolver_result_t ** of_resolve_host(OFString *host, uint16_t port, int type) { of_resolver_result_t **ret, **retIter; of_resolver_result_t *results, *resultsIter; size_t count; #ifdef HAVE_GETADDRINFO struct addrinfo hints = { 0 }, *res, *res0; |
︙ | ︙ | |||
171 172 173 174 175 176 177 | addr->sin_family = AF_INET; addr->sin_port = OF_BSWAP16_IF_LE(port); addr->sin_addr.s_addr = s_addr; tmp->family = AF_INET; tmp->type = type; tmp->protocol = 0; | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | addr->sin_family = AF_INET; addr->sin_port = OF_BSWAP16_IF_LE(port); addr->sin_addr.s_addr = s_addr; tmp->family = AF_INET; tmp->type = type; tmp->protocol = 0; tmp->address = (struct sockaddr *)addr; #ifndef OF_WII tmp->addressLength = sizeof(*addr); #else tmp->addressLength = 8; #endif ret[0] = tmp; |
︙ | ︙ | |||
231 232 233 234 235 236 237 | @throw [OFOutOfRangeException exception]; memcpy(&addrsIter->sin_addr.s_addr, *ip, he->h_length); resultsIter->family = he->h_addrtype; resultsIter->type = type; resultsIter->protocol = 0; | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | @throw [OFOutOfRangeException exception]; memcpy(&addrsIter->sin_addr.s_addr, *ip, he->h_length); resultsIter->family = he->h_addrtype; resultsIter->type = type; resultsIter->protocol = 0; resultsIter->address = (struct sockaddr *)addrsIter; resultsIter->addressLength = sizeof(*addrsIter); *retIter = resultsIter; } # ifdef OF_HAVE_THREADS } @finally { if (!of_mutex_unlock(&mutex)) |
︙ | ︙ | |||
306 307 308 309 310 311 312 | # if OF_HAVE_THREADS if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; @try { # endif if ((hostCString = inet_ntoa( | | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | # if OF_HAVE_THREADS if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; @try { # endif if ((hostCString = inet_ntoa( ((struct sockaddr_in *)(void *)address)->sin_addr)) == NULL) @throw [OFAddressTranslationFailedException exceptionWithError: h_errno]; if (host != NULL) *host = [OFString stringWithUTF8String: hostCString]; if (port != NULL) *port = OF_BSWAP16_IF_LE( ((struct sockaddr_in *)(void *)address)->sin_port); # if OF_HAVE_THREADS } @finally { if (!of_mutex_unlock(&mutex)) @throw [OFUnlockFailedException exception]; } # endif #endif |
︙ | ︙ |