mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
Fix some issues
This commit is contained in:
parent
0d839bd138
commit
467a4740da
4 changed files with 12 additions and 6 deletions
8
conout.c
8
conout.c
|
@ -54,7 +54,7 @@ typedef struct {
|
|||
* Doing colored output on windows is fucking stupid. The linux way is
|
||||
* the real way. So we emulate it on windows :)
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -104,7 +104,7 @@ static const int ansi2win[] = {
|
|||
WWHITE
|
||||
};
|
||||
|
||||
static int win_fputs(const char *str, FILE *h) {
|
||||
static int win_fputs(FILE *h, const char *str) {
|
||||
/* state for translate */
|
||||
int acolor;
|
||||
int wcolor;
|
||||
|
@ -168,7 +168,7 @@ static int win_fputs(const char *str, FILE *h) {
|
|||
state = -1;
|
||||
}
|
||||
} else {
|
||||
file_putc(*str, h);
|
||||
file_putc(h, *str);
|
||||
length ++;
|
||||
}
|
||||
str++;
|
||||
|
@ -212,7 +212,7 @@ static void con_enablecolor() {
|
|||
*/
|
||||
static int con_write(FILE *handle, const char *fmt, va_list va) {
|
||||
int ln;
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _WIN32
|
||||
ln = vfprintf(handle, fmt, va);
|
||||
#else
|
||||
{
|
||||
|
|
5
file.c
5
file.c
|
@ -165,6 +165,11 @@ int file_seek(FILE *fp, long int off, int whence) {
|
|||
return fseek(fp, off, whence);
|
||||
}
|
||||
|
||||
int file_putc(FILE *fp, int ch) {
|
||||
/* Invokes file_exception on windows if fp is null */
|
||||
return fputc(ch, fp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implements libc getline for systems that don't have it, which is
|
||||
* assmed all. This works the same as getline().
|
||||
|
|
1
gmqcc.h
1
gmqcc.h
|
@ -413,6 +413,7 @@ GMQCC_INLINE int file_error (FILE *);
|
|||
GMQCC_INLINE int file_getc (FILE *);
|
||||
GMQCC_INLINE int file_printf (FILE *, const char *, ...);
|
||||
GMQCC_INLINE int file_puts (FILE *, const char *);
|
||||
GMQCC_INLINE int file_putc (FILE *, int);
|
||||
GMQCC_INLINE int file_seek (FILE *, long int, int);
|
||||
|
||||
GMQCC_INLINE size_t file_read (void *, size_t, size_t, FILE *);
|
||||
|
|
4
test.c
4
test.c
|
@ -156,7 +156,7 @@ int task_pclose(FILE **handles) {
|
|||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
/*
|
||||
* Bidirectional piping implementation for windows using CreatePipe and DuplicateHandle +
|
||||
|
@ -185,7 +185,7 @@ int task_pclose(FILE **handles) {
|
|||
# ifdef __MINGW32__
|
||||
/* mingw32 has dirent.h */
|
||||
# include <dirent.h>
|
||||
# elif defined (_MSC_VER)
|
||||
# elif defined (_WIN32)
|
||||
/*
|
||||
* visual studio lacks dirent.h it's a posix thing
|
||||
* so we emulate it with the WinAPI.
|
||||
|
|
Loading…
Reference in a new issue