Bläddra i källkod

patch to compile civetweb.c with Mingw gcc 4.8.0 on windows (by Eric Trinh)

bel 11 år sedan
förälder
incheckning
4127492415
1 ändrade filer med 10 tillägg och 0 borttagningar
  1. 10 0
      src/civetweb.c

+ 10 - 0
src/civetweb.c

@@ -187,14 +187,22 @@ typedef struct {
     pthread_t *waitingthreadhdls;  /* The thread handles. */
     pthread_t *waitingthreadhdls;  /* The thread handles. */
 } pthread_cond_t;
 } pthread_cond_t;
 
 
+#ifndef __clockid_t_defined
 typedef DWORD clockid_t;
 typedef DWORD clockid_t;
+#endif
+#ifndef CLOCK_MONOTONIC
 #define CLOCK_MONOTONIC (1)
 #define CLOCK_MONOTONIC (1)
+#endif
+#ifndef CLOCK_REALTIME
 #define CLOCK_REALTIME  (2)
 #define CLOCK_REALTIME  (2)
+#endif
 
 
+#ifndef _TIMESPEC_DEFINED
 struct timespec {
 struct timespec {
     time_t   tv_sec;        /* seconds */
     time_t   tv_sec;        /* seconds */
     long     tv_nsec;       /* nanoseconds */
     long     tv_nsec;       /* nanoseconds */
 };
 };
+#endif
 
 
 #define pid_t HANDLE /* MINGW typedefs pid_t to int. Using #define here. */
 #define pid_t HANDLE /* MINGW typedefs pid_t to int. Using #define here. */
 
 
@@ -1197,6 +1205,7 @@ static int pthread_mutex_unlock(pthread_mutex_t *mutex)
     return ReleaseMutex(*mutex) == 0 ? -1 : 0;
     return ReleaseMutex(*mutex) == 0 ? -1 : 0;
 }
 }
 
 
+#ifndef WIN_PTHREADS_TIME_H
 static int clock_gettime(clockid_t clk_id, struct timespec *tp)
 static int clock_gettime(clockid_t clk_id, struct timespec *tp)
 {
 {
     FILETIME ft;
     FILETIME ft;
@@ -1232,6 +1241,7 @@ static int clock_gettime(clockid_t clk_id, struct timespec *tp)
 
 
     return ok ? 0 : -1;
     return ok ? 0 : -1;
 }
 }
+#endif
 
 
 static int pthread_cond_init(pthread_cond_t *cv, const void *unused)
 static int pthread_cond_init(pthread_cond_t *cv, const void *unused)
 {
 {