mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows: Fixed various compiler warnings and errors when building JUCE with MSVC's latest C++ 2017 support
This commit is contained in:
parent
f1a8e8f610
commit
2f2ff9437b
17 changed files with 30 additions and 101 deletions
|
|
@ -17,10 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "b2BlockAllocator.h"
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] =
|
||||
|
|
|
|||
|
|
@ -21,11 +21,6 @@
|
|||
|
||||
#include "b2Settings.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
/// This function is used to ensure that a floating point number is
|
||||
/// not a NaN or infinity.
|
||||
inline bool b2IsValid(float32 x)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "b2Settings.h"
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
|
||||
b2Version b2_version = {2, 2, 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,8 @@
|
|||
#ifndef B2_SETTINGS_H
|
||||
#define B2_SETTINGS_H
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#define B2_NOT_USED(x) ((void)(x))
|
||||
#define b2Assert(A) assert(A)
|
||||
#define b2Assert(A) jassert(A)
|
||||
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
|
|
|
|||
|
|
@ -18,83 +18,17 @@
|
|||
|
||||
#include "b2Timer.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
float64 b2Timer::s_invFrequency = 0.0f;
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
|
||||
if (s_invFrequency == 0.0f)
|
||||
{
|
||||
QueryPerformanceFrequency(&largeInteger);
|
||||
s_invFrequency = float64(largeInteger.QuadPart);
|
||||
if (s_invFrequency > 0.0f)
|
||||
{
|
||||
s_invFrequency = 1000.0f / s_invFrequency;
|
||||
}
|
||||
}
|
||||
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
m_start = float64(largeInteger.QuadPart);
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
m_start = float64(largeInteger.QuadPart);
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
LARGE_INTEGER largeInteger;
|
||||
QueryPerformanceCounter(&largeInteger);
|
||||
float64 count = float64(largeInteger.QuadPart);
|
||||
float32 ms = float32(s_invFrequency * (count - m_start));
|
||||
return ms;
|
||||
}
|
||||
|
||||
#elif defined(__linux__) || defined (__APPLE__)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
b2Timer::b2Timer()
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
timeval t;
|
||||
gettimeofday(&t, 0);
|
||||
m_start_sec = t.tv_sec;
|
||||
m_start_msec = t.tv_usec * 0.001f;
|
||||
juceStartTime = juce::Time::getCurrentTime();
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
timeval t;
|
||||
gettimeofday(&t, 0);
|
||||
return (t.tv_sec - m_start_sec) * 1000 + t.tv_usec * 0.001f - m_start_msec;
|
||||
return static_cast<float32> ((juce::Time::getCurrentTime() - juceStartTime).inMilliseconds());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
b2Timer::b2Timer()
|
||||
{
|
||||
}
|
||||
|
||||
void b2Timer::Reset()
|
||||
{
|
||||
}
|
||||
|
||||
float32 b2Timer::GetMilliseconds() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,14 +37,7 @@ public:
|
|||
float32 GetMilliseconds() const;
|
||||
|
||||
private:
|
||||
|
||||
#if defined(_WIN32)
|
||||
float64 m_start;
|
||||
static float64 s_invFrequency;
|
||||
#elif defined(__linux__) || defined (__APPLE__)
|
||||
unsigned long m_start_sec;
|
||||
unsigned long m_start_msec;
|
||||
#endif
|
||||
juce::Time juceStartTime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue