Skip to content

Commit 9380f51

Browse files
committed
Merge pull request #67 from larshg/libfreenect2mathfix
Added include <algorithm> in ifdef WIN32 and VS2013
2 parents 27549fe + 387bad6 commit 9380f51

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

examples/protonect/include/libfreenect2/protocol/response.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <sstream>
3232
#include <iomanip>
3333
#include <stdint.h>
34+
#include <algorithm>
3435

3536
namespace libfreenect2
3637
{
@@ -101,10 +102,10 @@ class FirmwareVersionResponse
101102
FWSubsystemVersion max;
102103
for(int i = 0; i < versions_.size(); ++i)
103104
{
104-
max.major = std::max(max.major, versions_[i].major);
105-
max.minor = std::max(max.minor, versions_[i].minor);
106-
max.build = std::max(max.build, versions_[i].build);
107-
max.revision = std::max(max.revision, versions_[i].revision);
105+
max.major = std::max<uint16_t>(max.major, versions_[i].major);
106+
max.minor = std::max<uint16_t>(max.minor, versions_[i].minor);
107+
max.build = std::max<uint16_t>(max.build, versions_[i].build);
108+
max.revision = std::max<uint16_t>(max.revision, versions_[i].revision);
108109
}
109110
std::stringstream version_string;
110111
version_string << max.major << "." << max.minor << "." << max.build << "." << max.revision << "." << versions_.size();

examples/protonect/src/cpu_depth_packet_processor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#include <iostream>
3333
#include <fstream>
3434

35+
#if defined(WIN32)
36+
#define _USE_MATH_DEFINES
37+
#include <math.h>
38+
#endif
39+
3540
namespace libfreenect2
3641
{
3742

examples/protonect/src/depth_packet_stream_parser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <libfreenect2/depth_packet_stream_parser.h>
2828
#include <iostream>
2929
#include <memory.h>
30+
#include <algorithm>
3031

3132
namespace libfreenect2
3233
{
@@ -69,7 +70,7 @@ void DepthPacketStreamParser::onDataReceived(unsigned char* buffer, size_t in_le
6970
DepthSubPacketFooter *footer = 0;
7071
bool footer_found = false;
7172

72-
size_t max_length = std::min(wb.capacity - wb.length, in_length - 8);
73+
size_t max_length = std::min<size_t>(wb.capacity - wb.length, in_length - 8);
7374

7475
for(; in_offset < max_length; ++in_offset)
7576
{

0 commit comments

Comments
 (0)