Skip to content

Commit

Permalink
win32: Fix compiler errors
Browse files Browse the repository at this point in the history
Signed-off-by: Benn Snyder <[email protected]>
  • Loading branch information
piedar committed Dec 19, 2014
1 parent 4487f12 commit e900868
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
11 changes: 9 additions & 2 deletions examples/camtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <string.h>
#include "libfreenect.h"

#ifndef SIGQUIT // win32 compat
#define SIGQUIT SIGTERM
#endif


void depth_cb(freenect_device* dev, void* data, uint32_t timestamp)
{
Expand All @@ -47,7 +51,6 @@ void signalHandler(int signal)
|| signal == SIGTERM
|| signal == SIGQUIT)
{
printf(" %s; shutting down\n", sys_siglist[signal]);
running = false;
}
}
Expand Down Expand Up @@ -75,7 +78,7 @@ int main(int argc, char** argv)
return ret;
if (num_devices == 0)
{
printf("No devices found!\n");
printf("No device found!\n");
freenect_shutdown(fn_ctx);
return 1;
}
Expand Down Expand Up @@ -127,11 +130,15 @@ int main(int argc, char** argv)

}

printf("Shutting down\n");

// Stop everything and shutdown.
freenect_stop_depth(fn_dev);
freenect_stop_video(fn_dev);
freenect_close_device(fn_dev);
freenect_shutdown(fn_ctx);

printf("Done!\n");

return 0;
}
7 changes: 4 additions & 3 deletions examples/glview.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <GL/glut.h>
#endif

#define _USE_MATH_DEFINES
#include <math.h>

pthread_t freenect_thread;
Expand Down Expand Up @@ -232,9 +233,9 @@ void keyPressed(unsigned char key, int x, int y)
mirror = mirror ? FREENECT_OFF : FREENECT_ON;
}
if (key == 'n') {
static freenect_flag_value near = FREENECT_ON;
freenect_set_flag(f_dev, FREENECT_NEAR_MODE, near);
near = near ? FREENECT_OFF : FREENECT_ON;
static freenect_flag_value near_mode = FREENECT_ON;
freenect_set_flag(f_dev, FREENECT_NEAR_MODE, near_mode);
near_mode = near_mode ? FREENECT_OFF : FREENECT_ON;
}
if (key == '1') {
freenect_set_led(f_dev,LED_GREEN);
Expand Down
8 changes: 4 additions & 4 deletions examples/micview.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ int main(int argc, char** argv) {

state.max_samples = 256 * 60;
state.current_idx = 0;
state.buffers[0] = malloc(state.max_samples * sizeof(int32_t));
state.buffers[1] = malloc(state.max_samples * sizeof(int32_t));
state.buffers[2] = malloc(state.max_samples * sizeof(int32_t));
state.buffers[3] = malloc(state.max_samples * sizeof(int32_t));
state.buffers[0] = (int32_t*)malloc(state.max_samples * sizeof(int32_t));
state.buffers[1] = (int32_t*)malloc(state.max_samples * sizeof(int32_t));
state.buffers[2] = (int32_t*)malloc(state.max_samples * sizeof(int32_t));
state.buffers[3] = (int32_t*)malloc(state.max_samples * sizeof(int32_t));
memset(state.buffers[0], 0, state.max_samples * sizeof(int32_t));
memset(state.buffers[1], 0, state.max_samples * sizeof(int32_t));
memset(state.buffers[2], 0, state.max_samples * sizeof(int32_t));
Expand Down
2 changes: 1 addition & 1 deletion platform/windows/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef long ssize_t;
#endif // _SSIZE_T_DEFINED


void usleep(__int64 usec)
static void usleep(__int64 usec)
{
// Convert to 100 nanosecond interval, negative for relative time.
LARGE_INTEGER ft;
Expand Down

0 comments on commit e900868

Please sign in to comment.