MinGW compilation fixes.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1068 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2003-07-19 01:20:50 +00:00
parent 027262a356
commit 32eb481811
9 changed files with 131 additions and 73 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3:
- MinGW compilation fixes - SvdB+Mika
- Bilinear scaler is now faster, has 24bpp mode and uses regions -Alex
- Accept CRLF line endings in .txt and .ts files - SvdB
- Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika
+53 -17
View File
@@ -3,9 +3,10 @@
#include "config.h"
#ifdef _MSC_VER
#define alloca _alloca
#define snprintf _snprintf
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
#endif
#ifndef HAVE_STRICMP
@@ -16,30 +17,56 @@
char *strupr (char *str);
#endif
// Compilation related
#ifdef _MSC_VER
# define inline __inline
#else
# define inline __inline__
#endif
// Directories
#ifdef WIN32
# include <stdlib.h>
# define PATH_MAX _MAX_PATH
# define NAME_MAX _MAX_FNAME
// _MAX_DIR and FILENAME_MAX could also be candidates.
// If anyone can tell me which one matches NAME_MAX, please
// tell me. - SvdB
// let me know. - SvdB
#else
/* PATH_MAX is per POSIX defined in <limits.h> */
# include <limits.h>
/* PATH_MAX is per POSIX defined in <limits.h> */
#endif
// Some types
#ifdef WIN32
typedef int ssize_t;
#endif
#ifdef _MSC_VER
# include <io.h>
typedef int ssize_t;
typedef unsigned short mode_t;
#endif
// Directories
#include <sys/stat.h>
#ifdef WIN32
# ifdef _MSC_VER
# define MKDIR(name, mode) ((void) mode, _mkdir(name))
# else
# define MKDIR(name, mode) ((void) mode, mkdir(name))
# endif
#else
# define MKDIR mkdir
#endif
#ifdef _MSC_VER
# include <direct.h>
# define chdir _chdir
# define getcwd _getcwd
# define access _access
# define F_OK 0
# define W_OK 2
# define R_OK 4
# include <direct.h>
# define open _open
# define mkdir _mkdir
# define read _read
# define rmdir _rmdir
//# define fstat _fstat
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
# define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
@@ -51,15 +78,24 @@ typedef unsigned short mode_t;
//# define stat _stat
# define unlink _unlink
#elif defined (__MINGW32__)
typedef int ssize_t;
typedef unsigned short mode_t;
# define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
# define S_IRWXG 0
# define S_IRWXO 0
# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
#else
# include <unistd.h>
#endif
// Memory
#ifdef WIN32
# ifdef __MINGW32__
# include <malloc.h>
# elif defined (_MSC_VER)
# define alloca _alloca
# endif
#elif defined (__linux__)
# include <alloca.h>
#endif
// Printf
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#endif /* _PORT_H */
+1 -5
View File
@@ -41,11 +41,7 @@
int
createDirectory(const char *dir, int mode)
{
#ifdef WIN32
return mkdir (dir);
#else
return mkdir (dir, (mode_t) mode);
#endif
return MKDIR(dir, mode);
}
// make all components of the path if they don't exist already
@@ -30,8 +30,10 @@ SDL_Surface* TFB_GL_DisplayFormatAlpha (SDL_Surface *surface);
#ifdef HAVE_OPENGL
#ifdef WIN32
#ifdef _MSC_VER
#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#endif
/* To avoid including windows.h,
Win32's <GL/gl.h> needs APIENTRY and WINGDIAPI defined properly. */
@@ -25,7 +25,7 @@
#include "types.h"
#include "uio.h"
#ifdef WIN32
#ifdef _MSC_VER
# pragma comment (lib, "vorbisfile.lib")
#endif
@@ -61,8 +61,10 @@ static char *strdup(const char *str)
# ifndef __STDC__
# define __STDC__
# endif
# ifdef _MSC_VER
# pragma warning(disable:4761)
# endif
#endif
#ifdef __cplusplus
extern "C" {
@@ -22,7 +22,9 @@
# ifdef WIN32
# include <al.h>
# include <alc.h>
# ifdef _MSC_VER
# pragma comment (lib, "OpenAL32.lib")
# endif
#else
# include <AL/al.h>
# include <AL/alc.h>
-6
View File
@@ -23,12 +23,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <malloc.h>
# define alloca _alloca
#elif defined (__linux__)
# include <alloca.h>
#endif
#include "uioport.h"
#define uio_malloc malloc
+56 -31
View File
@@ -21,6 +21,21 @@
#ifndef _UIOPORT_H
#define _UIOPORT_H
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
#endif
// Compilation related
#ifdef _MSC_VER
# define inline __inline
#else
# define inline __inline__
#endif
// Paths
#ifdef WIN32
# include <stdlib.h>
# define PATH_MAX _MAX_PATH
@@ -28,33 +43,42 @@
// _MAX_DIR and FILENAME_MAX could also be candidates.
// If anyone can tell me which one matches NAME_MAX, please
// let me know.
# define inline __inline
typedef short uid_t;
typedef short gid_t;
#else
# include <limits.h>
/* PATH_MAX is per POSIX defined in <limits.h> */
# define inline __inline__
#endif
// User ids
#ifdef WIN32
typedef short uid_t;
typedef short gid_t;
#endif
// Some types
#ifdef WIN32
# include <io.h>
# define mkdir MS_INSANE_MKDIR
// direct.h would give a bad definition of mkdir(). Now it gives
// a bad definition of MS_INSANE_MKDIR(), which we won't use.
// Yes, it's a hack, but this way the hack will stay local to
// the MS-specific stuff.
# include <direct.h>
# undef mkdir
typedef unsigned short mode_t;
static inline int
mkdir(const char *pathname, mode_t mode) {
(void) mode;
return _mkdir(pathname);
}
#endif /* WIN32 */
#ifdef _MSC_VER
# include <sys/stat.h>
typedef int ssize_t;
#endif
#ifdef _MSC_VER
typedef unsigned short mode_t;
#endif
// Directories
#include <sys/stat.h>
#ifdef WIN32
# ifdef _MSC_VER
# define MKDIR(name, mode) ((void) mode, _mkdir(name))
# else
# define MKDIR(name, mode) ((void) mode, mkdir(name))
# endif
#else
# define MKDIR mkdir
#endif
#ifdef _MSC_VER
# include <direct.h>
# define chdir _chdir
# define getcwd _getcwd
# define chdir _chdir
# define getcwd _getcwd
# define access _access
# define F_OK 0
# define W_OK 2
@@ -90,12 +114,6 @@ typedef int ssize_t;
# define stat _stat
# define unlink _unlink
#elif defined (__MINGW32__)
typedef int ssize_t;
typedef unsigned short mode_t;
# define S_IRUSR S_IREAD
# define S_IWUSR S_IWRITE
# define S_IXUSR S_IEXEC
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
# define S_IRGRP 0
# define S_IWGRP 0
# define S_IXGRP 0
@@ -110,12 +128,19 @@ typedef unsigned short mode_t;
# define S_IFREG _S_IFREG
# define S_IFCHR _S_IFCHR
# define S_IFDIR _S_IFDIR
# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
#else
# include <unistd.h>
#endif
// Memory related:
#ifdef WIN32
# ifdef __MINGW32__
# include <malloc.h>
# elif defined (_MSC_VER)
# define alloca _alloca
# endif
#elif defined (__linux__)
# include <alloca.h>
#endif
#endif /* _UIOPORT_H */