* SF Bug Tracker [ 1902668 ] Cannot compile on MSVC
Submitted By Luke Kim - nereusuj Version 1.6.5 cannot be compiled because of some changes in 1.6.3. MSVC does not support stdint.h, gettimeofday(), sys/param.h, const int variables in array size and Windows does not define _WINDOWS_ but define _WINDOWS. * MSVC does not understand "const int"'s as declarators of array dimensions, we must use #define'd constants. * Use WIN32 instead of _WINDOWS_ or _WINDOWS. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@331 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
@@ -79,7 +79,20 @@ typedef enum priority {LOW_PRIORITY,
|
||||
#endif
|
||||
|
||||
#include "LinkedList.h"
|
||||
#include <sys/time.h> /* for gettimeofday() */
|
||||
|
||||
#ifdef WIN32
|
||||
#include <time.h>
|
||||
#include <winsock2.h>
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#else /* WIN32 */
|
||||
#include <sys/time.h> /* for gettimeofday() */
|
||||
#endif
|
||||
|
||||
#include "FreeList.h"
|
||||
|
||||
#include "ithread.h"
|
||||
|
@@ -30,11 +30,13 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "LinkedList.h"
|
||||
#include <sys/param.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
@@ -532,3 +534,4 @@ ListSize( LinkedList * list )
|
||||
|
||||
return list->size;
|
||||
}
|
||||
|
||||
|
@@ -1597,3 +1597,45 @@ int ThreadPoolGetStats( ThreadPool *tp, ThreadPoolStats *stats )
|
||||
|
||||
#endif /* STATS */
|
||||
|
||||
#ifdef WIN32
|
||||
#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 /* WIN32 */
|
||||
|
Reference in New Issue
Block a user