mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-09 21:14:02 +00:00
ldns initial round for windows compatibility
This commit is contained in:
@@ -42,7 +42,9 @@
|
||||
#include <ldns/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#include <ldns/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#include <ldns/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#include <ldns/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
|
||||
#include <ldns/config.h>
|
||||
#include <ldns/common.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -40,8 +40,12 @@
|
||||
#define _FAKE_RFC2553_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#include <ldns/config.h>
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
|
||||
#include < time.h >
|
||||
#include < windows.h>
|
||||
#include <compat/gettimeofday.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
|
||||
#else
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
|
||||
#endif
|
||||
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
unsigned __int64 tmpres = 0;
|
||||
static int tzflag;
|
||||
|
||||
if (NULL != tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
tmpres |= ft.dwHighDateTime;
|
||||
tmpres <<= 32;
|
||||
tmpres |= ft.dwLowDateTime;
|
||||
|
||||
/*converting file time to unix epoch*/
|
||||
tmpres /= 10; /*convert into microseconds*/
|
||||
tmpres -= DELTA_EPOCH_IN_MICROSECS;
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
|
||||
#endif
|
||||
@@ -55,7 +55,9 @@
|
||||
#if !defined(HAVE_INET_ATON)
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
#ifndef HAVE_INET_NTOP
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
void *malloc ();
|
||||
#endif
|
||||
|
||||
/* Allocate an N-byte block of memory from the heap.
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <ldns/config.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
|
||||
void *memmove(void *dest, const void *src, size_t n)
|
||||
@@ -41,3 +42,4 @@ void *memmove(void *dest, const void *src, size_t n)
|
||||
memcpy(dest, src, n);
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
void *realloc (void*, size_t);
|
||||
void *malloc (size_t);
|
||||
#endif
|
||||
|
||||
/* Changes allocation to new sizes, copies over old data.
|
||||
* if oldptr is NULL, does a malloc.
|
||||
|
||||
Reference in New Issue
Block a user