lemon/bits/windows.cc
branch1.3
changeset 1145 5c247b4dc708
parent 1143 f70f688d9ef9
     1.1 --- a/lemon/bits/windows.cc	Thu Apr 02 14:08:38 2015 +0200
     1.2 +++ b/lemon/bits/windows.cc	Tue Apr 28 18:12:39 2015 +0200
     1.3 @@ -21,7 +21,11 @@
     1.4  
     1.5  #include<lemon/bits/windows.h>
     1.6  
     1.7 -#ifdef WIN32
     1.8 +#if defined(LEMON_WIN32) && defined(__GNUC__)
     1.9 +#pragma GCC diagnostic ignored "-Wold-style-cast"
    1.10 +#endif
    1.11 +
    1.12 +#ifdef LEMON_WIN32
    1.13  #ifndef WIN32_LEAN_AND_MEAN
    1.14  #define WIN32_LEAN_AND_MEAN
    1.15  #endif
    1.16 @@ -40,7 +44,7 @@
    1.17  #else
    1.18  #include <unistd.h>
    1.19  #include <ctime>
    1.20 -#ifndef WIN32
    1.21 +#ifndef LEMON_WIN32
    1.22  #include <sys/times.h>
    1.23  #endif
    1.24  #include <sys/time.h>
    1.25 @@ -55,7 +59,7 @@
    1.26                           double &utime, double &stime,
    1.27                           double &cutime, double &cstime)
    1.28      {
    1.29 -#ifdef WIN32
    1.30 +#ifdef LEMON_WIN32
    1.31        static const double ch = 4294967296.0e-7;
    1.32        static const double cl = 1.0e-7;
    1.33  
    1.34 @@ -94,11 +98,11 @@
    1.35      std::string getWinFormattedDate()
    1.36      {
    1.37        std::ostringstream os;
    1.38 -#ifdef WIN32
    1.39 +#ifdef LEMON_WIN32
    1.40        SYSTEMTIME time;
    1.41        GetSystemTime(&time);
    1.42        char buf1[11], buf2[9], buf3[5];
    1.43 -          if (GetDateFormat(MY_LOCALE, 0, &time,
    1.44 +      if (GetDateFormat(MY_LOCALE, 0, &time,
    1.45                          ("ddd MMM dd"), buf1, 11) &&
    1.46            GetTimeFormat(MY_LOCALE, 0, &time,
    1.47                          ("HH':'mm':'ss"), buf2, 9) &&
    1.48 @@ -120,7 +124,7 @@
    1.49  
    1.50      int getWinRndSeed()
    1.51      {
    1.52 -#ifdef WIN32
    1.53 +#ifdef LEMON_WIN32
    1.54        FILETIME time;
    1.55        GetSystemTimeAsFileTime(&time);
    1.56        return GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime;
    1.57 @@ -132,7 +136,7 @@
    1.58      }
    1.59  
    1.60      WinLock::WinLock() {
    1.61 -#ifdef WIN32
    1.62 +#ifdef LEMON_WIN32
    1.63        CRITICAL_SECTION *lock = new CRITICAL_SECTION;
    1.64        InitializeCriticalSection(lock);
    1.65        _repr = lock;
    1.66 @@ -142,7 +146,7 @@
    1.67      }
    1.68  
    1.69      WinLock::~WinLock() {
    1.70 -#ifdef WIN32
    1.71 +#ifdef LEMON_WIN32
    1.72        CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    1.73        DeleteCriticalSection(lock);
    1.74        delete lock;
    1.75 @@ -150,14 +154,14 @@
    1.76      }
    1.77  
    1.78      void WinLock::lock() {
    1.79 -#ifdef WIN32
    1.80 +#ifdef LEMON_WIN32
    1.81        CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    1.82        EnterCriticalSection(lock);
    1.83  #endif
    1.84      }
    1.85  
    1.86      void WinLock::unlock() {
    1.87 -#ifdef WIN32
    1.88 +#ifdef LEMON_WIN32
    1.89        CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
    1.90        LeaveCriticalSection(lock);
    1.91  #endif