Implement a new safer Limelog for Windows
This commit is contained in:
parent
a29fb05f6c
commit
d67071cf0e
2 changed files with 15 additions and 7 deletions
|
|
@ -1,13 +1,22 @@
|
||||||
#include "PlatformThreads.h"
|
#include "PlatformThreads.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#if defined(LC_WINDOWS)
|
|
||||||
WCHAR DbgBuf[512];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int initializePlatformSockets(void);
|
int initializePlatformSockets(void);
|
||||||
void cleanupPlatformSockets(void);
|
void cleanupPlatformSockets(void);
|
||||||
|
|
||||||
|
#if defined(LC_WINDOWS)
|
||||||
|
void LimelogWindows(char* Format, ...) {
|
||||||
|
va_list va;
|
||||||
|
char buffer[1024];
|
||||||
|
|
||||||
|
va_start(va, Format);
|
||||||
|
vsprintf(buffer, Format, va);
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
|
OutputDebugStringA(buffer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
PLT_MUTEX thread_list_lock;
|
PLT_MUTEX thread_list_lock;
|
||||||
PLT_THREAD *thread_head;
|
PLT_THREAD *thread_head;
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,9 @@
|
||||||
#include "Limelight.h"
|
#include "Limelight.h"
|
||||||
|
|
||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
extern WCHAR DbgBuf[512];
|
void LimelogWindows(char* Format, ...);
|
||||||
#define Limelog(s, ...) \
|
#define Limelog(s, ...) \
|
||||||
swprintf(DbgBuf, sizeof(DbgBuf) / sizeof(WCHAR), L ## s, ##__VA_ARGS__); \
|
LimelogWindows(s, ##__VA_ARGS__)
|
||||||
OutputDebugStringW(DbgBuf)
|
|
||||||
#else
|
#else
|
||||||
#define Limelog(s, ...) \
|
#define Limelog(s, ...) \
|
||||||
fprintf(stderr, s, ##__VA_ARGS__)
|
fprintf(stderr, s, ##__VA_ARGS__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue