Commit c44afab4 authored by Simon Morlat's avatar Simon Morlat

fix warnings and errors

parent b079a624
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
#ifdef _WIN32 #ifdef _WIN32
extern void OutputDebugStringPrintf(const char *fmt, ...); extern void OutputDebugStringPrintf(FILE *file, const char *fmt, ...);
#define fprintf(file, fmt, ...) OutputDebugStringPrintf(fmt, ##__VA_ARGS__) #define fprintf(file, fmt, ...) OutputDebugStringPrintf(file, fmt, ##__VA_ARGS__)
#elif defined(ANDROID) #elif defined(ANDROID)
extern void AndroidPrintf(FILE *file, const char *fmt, ...); extern void AndroidPrintf(FILE *file, const char *fmt, ...);
#define fprintf(file, fmt, ...) AndroidPrintf(file, fmt, ##__VA_ARGS__) #define fprintf(file, fmt, ...) AndroidPrintf(file, fmt, ##__VA_ARGS__)
......
...@@ -86,8 +86,8 @@ ...@@ -86,8 +86,8 @@
#include "CUnit_intl.h" #include "CUnit_intl.h"
#ifdef _WIN32 #ifdef _WIN32
extern void OutputDebugStringPrintf(const char *fmt, ...); extern void OutputDebugStringPrintf(FILE *file, const char *fmt, ...);
#define fprintf(file, fmt, ...) OutputDebugStringPrintf(fmt, ##__VA_ARGS__) #define fprintf(file, fmt, ...) OutputDebugStringPrintf(file, fmt, ##__VA_ARGS__)
#elif defined(ANDROID) #elif defined(ANDROID)
extern void AndroidPrintf(FILE *file, const char *fmt, ...); extern void AndroidPrintf(FILE *file, const char *fmt, ...);
#define fprintf(file, fmt, ...) AndroidPrintf(file, fmt, ##__VA_ARGS__) #define fprintf(file, fmt, ...) AndroidPrintf(file, fmt, ##__VA_ARGS__)
...@@ -96,7 +96,6 @@ extern void otherPrintf(FILE *file, const char *fmt, ...); ...@@ -96,7 +96,6 @@ extern void otherPrintf(FILE *file, const char *fmt, ...);
#define fprintf(file, fmt, ...) otherPrintf(file, fmt, ##__VA_ARGS__) #define fprintf(file, fmt, ...) otherPrintf(file, fmt, ##__VA_ARGS__)
#endif #endif
/*================================================================= /*=================================================================
* Global/Static Definitions * Global/Static Definitions
*=================================================================*/ *=================================================================*/
...@@ -577,7 +576,7 @@ CU_EXPORT char * CU_get_run_results_string(void) ...@@ -577,7 +576,7 @@ CU_EXPORT char * CU_get_run_results_string(void)
{ {
CU_pRunSummary pRunSummary = &f_run_summary; CU_pRunSummary pRunSummary = &f_run_summary;
CU_pTestRegistry pRegistry = CU_get_registry(); CU_pTestRegistry pRegistry = CU_get_registry();
size_t width[9]; int width[9];
size_t len; size_t len;
char *result; char *result;
......
...@@ -60,16 +60,16 @@ extern cunit_trace_handler_t CU_trace_handler; ...@@ -60,16 +60,16 @@ extern cunit_trace_handler_t CU_trace_handler;
#include <winsock2.h> #include <winsock2.h>
void OutputDebugStringPrintf(const char *fmt, ...) { void OutputDebugStringPrintf(FILE *file, const char *fmt, ...) {
char msg[512];
va_list args; va_list args;
int len;
va_start(args, fmt); va_start(args, fmt);
if (CU_trace_handler) { if (CU_trace_handler) {
CU_trace_handler(1, fmt, args); CU_trace_handler(1, fmt, args);
} else { } else {
#ifdef _MSC_VER #ifdef _MSC_VER
char msg[512];
int len;
len = vsnprintf(msg, sizeof(msg), fmt, args); len = vsnprintf(msg, sizeof(msg), fmt, args);
if (len > 0) { if (len > 0) {
#ifndef _UNICODE #ifndef _UNICODE
...@@ -79,9 +79,11 @@ void OutputDebugStringPrintf(const char *fmt, ...) { ...@@ -79,9 +79,11 @@ void OutputDebugStringPrintf(const char *fmt, ...) {
mbstowcs(tmp, msg, len); mbstowcs(tmp, msg, len);
OutputDebugString(tmp); OutputDebugString(tmp);
free(tmp); free(tmp);
#endif
#endif #endif
} }
#else
fprintf(file, fmt, args);
#endif
} }
va_end(args); va_end(args);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment