Fix some casting stuff

This commit is contained in:
Dale Weiler 2012-11-22 20:16:34 +00:00
parent a8b31be328
commit 6ea37089fa

12
con.c
View file

@ -30,8 +30,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#define GMQCC_IS_STDOUT(X) ((X) == stdout) #define GMQCC_IS_STDOUT(X) ((FILE*)((void*)X) == stdout)
#define GMQCC_IS_STDERR(X) ((X) == stderr) #define GMQCC_IS_STDERR(X) ((FILE*)((void*)X) == stderr)
#define GMQCC_IS_DEFINE(X) (GMQCC_IS_STDERR(X) || GMQCC_IS_STDOUT(X)) #define GMQCC_IS_DEFINE(X) (GMQCC_IS_STDERR(X) || GMQCC_IS_STDOUT(X))
typedef struct { typedef struct {
@ -271,13 +271,13 @@ void con_reset() {
int con_change(const char *out, const char *err) { int con_change(const char *out, const char *err) {
con_close(); con_close();
if (GMQCC_IS_DEFINE((FILE*)out)) { if (GMQCC_IS_DEFINE(out)) {
console.handle_out = (((FILE*)out) == stdout) ? stdout : stderr; console.handle_out = GMQCC_IS_STDOUT(out) ? stdout : stderr;
con_enablecolor(); con_enablecolor();
} else if (!(console.handle_out = fopen(out, "w"))) return 0; } else if (!(console.handle_out = fopen(out, "w"))) return 0;
if (GMQCC_IS_DEFINE((FILE*)err)) { if (GMQCC_IS_DEFINE(err)) {
console.handle_err = (((FILE*)err) == stdout) ? stdout : stderr; console.handle_err = GMQCC_IS_STDOUT(err) ? stdout : stderr;
con_enablecolor(); con_enablecolor();
} else if (!(console.handle_err = fopen(err, "w"))) return 0; } else if (!(console.handle_err = fopen(err, "w"))) return 0;