Skip to content

Commit 98aaf46

Browse files
committed
openni2: Fix compiler warnings and extra headers
1 parent 4133056 commit 98aaf46

File tree

11 files changed

+19
-27
lines changed

11 files changed

+19
-27
lines changed

src/openni2/ColorStream.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* either License.
2525
*/
2626

27-
#include <string>
27+
#define _USE_MATH_DEFINES
28+
#include <cmath> // for M_PI
2829
#include "ColorStream.hpp"
2930

3031
using namespace Freenect2Driver;

src/openni2/ColorStream.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#pragma once
2828

29-
#include <algorithm> // for transform()
30-
#include <cmath> // for M_PI
3129
#include <map>
3230
#include <libfreenect2/libfreenect2.hpp>
3331
#include <Driver/OniDriverAPI.h>

src/openni2/DepthStream.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* either License.
2525
*/
2626

27-
#include <string>
27+
#define _USE_MATH_DEFINES
28+
#include <cmath> // for M_PI
2829
#include "DepthStream.hpp"
2930

3031
using namespace Freenect2Driver;
@@ -74,7 +75,7 @@ void DepthStream::populateFrame(libfreenect2::Frame* srcFrame, int srcX, int src
7475
if (reg->isEnabled())
7576
reg->depthFrame(srcFrame);
7677

77-
if (srcFrame->width < dstFrame->width || srcFrame->height < dstFrame->height)
78+
if (srcFrame->width < (size_t)dstFrame->width || srcFrame->height < (size_t)dstFrame->height)
7879
memset(dstFrame->data, 0x00, dstFrame->width * dstFrame->height * 2);
7980

8081
// copy stream buffer from freenect

src/openni2/DepthStream.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@
2626

2727
#pragma once
2828

29-
#include <algorithm> // for transform()
30-
#include <cmath> // for M_PI
31-
#include <cstdio> // for memcpy
3229
#include <libfreenect2/libfreenect2.hpp>
3330
#include <Driver/OniDriverAPI.h>
34-
#include "PS1080.h"
3531
#include "VideoStream.hpp"
3632

3733

src/openni2/DeviceDriver.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace Freenect2Driver
9393
{
9494
listener.waitForNewFrame(frames);
9595

96-
for (int i = 0; i < sizeof(streams)/sizeof(*streams); i++) {
96+
for (unsigned i = 0; i < sizeof(streams)/sizeof(*streams); i++) {
9797
struct streams& s = streams[i];
9898
VideoStream* stream = getStream(s.type);
9999
libfreenect2::Frame *frame = frames[s.type];
@@ -131,10 +131,10 @@ namespace Freenect2Driver
131131
public:
132132
Device(int index) : //libfreenect2::Freenect2Device(fn_ctx, index),
133133
dev(NULL),
134-
reg(NULL),
135134
color(NULL),
136-
ir(NULL),
137135
depth(NULL),
136+
ir(NULL),
137+
reg(NULL),
138138
device_stop(false),
139139
listener(libfreenect2::Frame::Depth | libfreenect2::Frame::Ir | libfreenect2::Frame::Color),
140140
thread(NULL)
@@ -427,7 +427,7 @@ namespace Freenect2Driver
427427

428428
WriteMessage("Found device " + uri);
429429

430-
for (int i = 0; i < modes.size(); i++) {
430+
for (unsigned i = 0; i < modes.size(); i++) {
431431
register_uri(uri + modes[i]);
432432
}
433433

@@ -452,15 +452,15 @@ namespace Freenect2Driver
452452
{
453453
std::string uri(c_uri);
454454
std::string mode(c_mode ? c_mode : "");
455-
if (uri.find("?") != -1) {
455+
if (uri.find("?") != std::string::npos) {
456456
mode += "&";
457457
mode += uri.substr(uri.find("?") + 1);
458458
uri = uri.substr(0, uri.find("?"));
459459
}
460460
std::stringstream ss(mode);
461461
std::string buf;
462462
while(std::getline(ss, buf, '&')) {
463-
if (buf.find("=") != -1) {
463+
if (buf.find("=") != std::string::npos) {
464464
config[buf.substr(0, buf.find("="))] = buf.substr(buf.find("=")+1);
465465
} else {
466466
if (0 < buf.length())
@@ -506,7 +506,7 @@ namespace Freenect2Driver
506506
if (iter->second == pDevice)
507507
{
508508
WriteMessage("Closing device " + std::string(iter->first.uri));
509-
int id = uri_to_devid(iter->first.uri);
509+
//int id = uri_to_devid(iter->first.uri);
510510

511511
Device* device = (Device*)iter->second;
512512
device->stop();
@@ -550,7 +550,7 @@ namespace Freenect2Driver
550550

551551

552552
// macros defined in XnLib (not included) - workaround
553-
#define XN_NEW(type, arg...) new type(arg)
553+
#define XN_NEW(type, arg) new type(arg)
554554
#define XN_DELETE(p) delete(p)
555555
ONI_EXPORT_DRIVER(Freenect2Driver::Driver);
556556
#undef XN_NEW

src/openni2/IrStream.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* either License.
2525
*/
2626

27-
#include <string>
27+
#define _USE_MATH_DEFINES
28+
#include <cmath> // for M_PI
2829
#include "IrStream.hpp"
2930

3031
using namespace Freenect2Driver;

src/openni2/IrStream.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@
2626

2727
#pragma once
2828

29-
#include <algorithm> // for transform()
30-
#include <cmath> // for M_PI
31-
#include <cstdio> // for memcpy
3229
#include <libfreenect2/libfreenect2.hpp>
3330
#include <Driver/OniDriverAPI.h>
34-
#include "PS1080.h"
3531
#include "VideoStream.hpp"
3632

3733
namespace Freenect2Driver

src/openni2/Registration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626

2727
#include <iostream>
28-
#include "Driver/OniDriverAPI.h"
28+
#include <Driver/OniDriverAPI.h>
2929
#include "Registration.hpp"
3030

3131
using namespace Freenect2Driver;

src/openni2/Utility.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626

2727
// This file contains symbols that may be used by any class or don't really go anywhere else.
28-
#include <iostream>
28+
#include <cstring>
2929
#include "Driver/OniDriverAPI.h"
3030

3131

src/openni2/Utility.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
// This file contains symbols that may be used by any class or don't really go anywhere else.
2828
#pragma once
2929

30-
#include <iostream>
31-
#include "Driver/OniDriverAPI.h"
30+
#include <Driver/OniDriverAPI.h>
3231
#include <sstream>
3332

3433
// Oni helpers

0 commit comments

Comments
 (0)