Browse Source

dns: исправить сборку под Windows (MinGW)

- dns.c: #define uint32_t → #include <stdint.h> (на UCRT64 stdint.h уже тянется через winsock2.h, макро даёт 'duplicate unsigned')
- async_dns.c: p->IpAddress → p->IpAddress.String (IP_ADDR_STRING.IpAddress — IP_ADDRESS_STRING, не char*)
topo_upd
Evgeny 2 months ago
parent
commit
0c3398eb8c
  1. 2
      lib/async_dns.c
  2. 4
      lib/dns.c

2
lib/async_dns.c

@ -92,7 +92,7 @@ int adns_system_servers(struct sockaddr_in* out, int max) {
int n = 0; int n = 0;
IP_ADDR_STRING* p = &fi->DnsServerList; IP_ADDR_STRING* p = &fi->DnsServerList;
while (p && n < max) { while (p && n < max) {
const char* s = p->IpAddress; const char* s = p->IpAddress.String;
while (*s && n < max) { while (*s && n < max) {
while (*s == ' ' || *s == ',') s++; while (*s == ' ' || *s == ',') s++;
char tok[64]; char tok[64];

4
lib/dns.c

@ -40,11 +40,7 @@
#include <limits.h> /* INT_MAX */ #include <limits.h> /* INT_MAX */
#include <stddef.h> /* offsetof() */ #include <stddef.h> /* offsetof() */
#ifdef _WIN32
#define uint32_t unsigned int
#else
#include <stdint.h> /* uint32_t */ #include <stdint.h> /* uint32_t */
#endif
#include <stdlib.h> /* malloc(3) realloc(3) free(3) rand(3) random(3) arc4random(3) */ #include <stdlib.h> /* malloc(3) realloc(3) free(3) rand(3) random(3) arc4random(3) */
#include <stdio.h> /* FILE fopen(3) fclose(3) getc(3) rewind(3) */ #include <stdio.h> /* FILE fopen(3) fclose(3) getc(3) rewind(3) */
#include <string.h> /* memcpy(3) strlen(3) memmove(3) memchr(3) memcmp(3) strchr(3) strsep(3) strcspn(3) */ #include <string.h> /* memcpy(3) strlen(3) memmove(3) memchr(3) memcmp(3) strchr(3) strsep(3) strcspn(3) */

Loading…
Cancel
Save