Add assert support for *NIX platforms. Asserts are now disabled by default. Define LC_DEBUG to enable them.

This commit is contained in:
Cameron Gutman 2015-07-15 03:40:47 -04:00
parent cc9614645c
commit 109e3ca537
2 changed files with 17 additions and 5 deletions

View File

@ -8,6 +8,9 @@
extern "C" {
#endif
// Enable this definition during debugging to enable assertions
//#define LC_DEBUG
typedef struct _STREAM_CONFIGURATION {
// Dimensions in pixels of the desired video stream
int width;

View File

@ -27,6 +27,7 @@
#include <stdio.h>
#include "Limelight.h"
#if defined(LC_WINDOWS)
extern WCHAR DbgBuf[512];
#define Limelog(s, ...) \
@ -38,14 +39,22 @@ extern WCHAR DbgBuf[512];
#endif
#if defined(LC_WINDOWS)
#include <crtdbg.h>
#define LC_ASSERT(x) __analysis_assume(x); \
_ASSERTE(x)
#include <crtdbg.h>
#ifdef LC_DEBUG
#define LC_ASSERT(x) __analysis_assume(x); \
_ASSERTE(x)
#else
#define LC_ASSERT(x)
#endif
#else
#define LC_ASSERT(x)
#ifndef LC_DEBUG
#define NDEBUG
#endif
#include <assert.h>
#define LC_ASSERT(x) assert(x)
#endif
int initializePlatform(void);
void cleanupPlatform(void);
uint64_t PltGetMillis(void);
uint64_t PltGetMillis(void);