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:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.3:
|
Changes towards version 0.3:
|
||||||
|
- MinGW compilation fixes - SvdB+Mika
|
||||||
- Bilinear scaler is now faster, has 24bpp mode and uses regions -Alex
|
- Bilinear scaler is now faster, has 24bpp mode and uses regions -Alex
|
||||||
- Accept CRLF line endings in .txt and .ts files - SvdB
|
- Accept CRLF line endings in .txt and .ts files - SvdB
|
||||||
- Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika
|
- Fixed overflow problem with 32bpp bilinear,biadapt,biadv scalers -Mika
|
||||||
|
|||||||
+54
-18
@@ -3,43 +3,70 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef WIN32
|
||||||
#define alloca _alloca
|
# include <io.h>
|
||||||
#define snprintf _snprintf
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRICMP
|
#ifndef HAVE_STRICMP
|
||||||
#define stricmp strcasecmp
|
# define stricmp strcasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRUPR
|
#ifndef HAVE_STRUPR
|
||||||
char *strupr (char *str);
|
char *strupr (char *str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Compilation related
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define inline __inline
|
||||||
|
#else
|
||||||
|
# define inline __inline__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Directories
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# define PATH_MAX _MAX_PATH
|
# define PATH_MAX _MAX_PATH
|
||||||
# define NAME_MAX _MAX_FNAME
|
# define NAME_MAX _MAX_FNAME
|
||||||
// _MAX_DIR and FILENAME_MAX could also be candidates.
|
// _MAX_DIR and FILENAME_MAX could also be candidates.
|
||||||
// If anyone can tell me which one matches NAME_MAX, please
|
// If anyone can tell me which one matches NAME_MAX, please
|
||||||
// tell me. - SvdB
|
// let me know. - SvdB
|
||||||
#else
|
#else
|
||||||
/* PATH_MAX is per POSIX defined in <limits.h> */
|
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
|
/* PATH_MAX is per POSIX defined in <limits.h> */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Some types
|
||||||
|
#ifdef WIN32
|
||||||
|
typedef int ssize_t;
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# include <io.h>
|
|
||||||
typedef int ssize_t;
|
|
||||||
typedef unsigned short mode_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 access _access
|
||||||
# define F_OK 0
|
# define F_OK 0
|
||||||
# define W_OK 2
|
# define W_OK 2
|
||||||
# define R_OK 4
|
# define R_OK 4
|
||||||
# include <direct.h>
|
|
||||||
# define open _open
|
# define open _open
|
||||||
# define mkdir _mkdir
|
|
||||||
# define read _read
|
# define read _read
|
||||||
# define rmdir _rmdir
|
|
||||||
//# define fstat _fstat
|
//# define fstat _fstat
|
||||||
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
|
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
|
||||||
# define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
|
# define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
|
||||||
@@ -51,15 +78,24 @@ typedef unsigned short mode_t;
|
|||||||
//# define stat _stat
|
//# define stat _stat
|
||||||
# define unlink _unlink
|
# define unlink _unlink
|
||||||
#elif defined (__MINGW32__)
|
#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_IRWXG 0
|
||||||
# define S_IRWXO 0
|
# define S_IRWXO 0
|
||||||
# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
|
#endif
|
||||||
# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
|
|
||||||
#else
|
// Memory
|
||||||
# include <unistd.h>
|
#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
|
||||||
|
|
||||||
#endif /* _PORT_H */
|
#endif /* _PORT_H */
|
||||||
|
|||||||
@@ -41,11 +41,7 @@
|
|||||||
int
|
int
|
||||||
createDirectory(const char *dir, int mode)
|
createDirectory(const char *dir, int mode)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
return MKDIR(dir, mode);
|
||||||
return mkdir (dir);
|
|
||||||
#else
|
|
||||||
return mkdir (dir, (mode_t) mode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// make all components of the path if they don't exist already
|
// 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 HAVE_OPENGL
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma comment (lib, "opengl32.lib")
|
#pragma comment (lib, "opengl32.lib")
|
||||||
#pragma comment (lib, "glu32.lib")
|
#pragma comment (lib, "glu32.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
/* To avoid including windows.h,
|
/* To avoid including windows.h,
|
||||||
Win32's <GL/gl.h> needs APIENTRY and WINGDIAPI defined properly. */
|
Win32's <GL/gl.h> needs APIENTRY and WINGDIAPI defined properly. */
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "uio.h"
|
#include "uio.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _MSC_VER
|
||||||
#pragma comment (lib, "vorbisfile.lib")
|
# pragma comment (lib, "vorbisfile.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct tfb_decoderformats
|
typedef struct tfb_decoderformats
|
||||||
|
|||||||
@@ -58,10 +58,12 @@ static char *strdup(const char *str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef __STDC__
|
# ifndef __STDC__
|
||||||
#define __STDC__
|
# define __STDC__
|
||||||
#endif
|
# endif
|
||||||
#pragma warning(disable:4761)
|
# ifdef _MSC_VER
|
||||||
|
# pragma warning(disable:4761)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -18,14 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SOUNDCHOOSER_H
|
#ifndef SOUNDCHOOSER_H
|
||||||
#define SOUNDCHOOSER_H
|
# define SOUNDCHOOSER_H
|
||||||
#ifdef WIN32
|
# ifdef WIN32
|
||||||
#include <al.h>
|
# include <al.h>
|
||||||
#include <alc.h>
|
# include <alc.h>
|
||||||
#pragma comment (lib, "OpenAL32.lib")
|
# ifdef _MSC_VER
|
||||||
|
# pragma comment (lib, "OpenAL32.lib")
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#include <AL/al.h>
|
# include <AL/al.h>
|
||||||
#include <AL/alc.h>
|
# include <AL/alc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mixsdl/mixer.h"
|
#include "mixsdl/mixer.h"
|
||||||
|
|||||||
@@ -23,12 +23,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef WIN32
|
|
||||||
# include <malloc.h>
|
|
||||||
# define alloca _alloca
|
|
||||||
#elif defined (__linux__)
|
|
||||||
# include <alloca.h>
|
|
||||||
#endif
|
|
||||||
#include "uioport.h"
|
#include "uioport.h"
|
||||||
|
|
||||||
#define uio_malloc malloc
|
#define uio_malloc malloc
|
||||||
|
|||||||
@@ -21,6 +21,21 @@
|
|||||||
#ifndef _UIOPORT_H
|
#ifndef _UIOPORT_H
|
||||||
#define _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
|
#ifdef WIN32
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# define PATH_MAX _MAX_PATH
|
# define PATH_MAX _MAX_PATH
|
||||||
@@ -28,33 +43,42 @@
|
|||||||
// _MAX_DIR and FILENAME_MAX could also be candidates.
|
// _MAX_DIR and FILENAME_MAX could also be candidates.
|
||||||
// If anyone can tell me which one matches NAME_MAX, please
|
// If anyone can tell me which one matches NAME_MAX, please
|
||||||
// let me know.
|
// let me know.
|
||||||
# define inline __inline
|
|
||||||
typedef short uid_t;
|
|
||||||
typedef short gid_t;
|
|
||||||
#else
|
#else
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
/* PATH_MAX is per POSIX defined in <limits.h> */
|
/* PATH_MAX is per POSIX defined in <limits.h> */
|
||||||
# define inline __inline__
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// User ids
|
||||||
|
#ifdef WIN32
|
||||||
|
typedef short uid_t;
|
||||||
|
typedef short gid_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Some types
|
||||||
#ifdef WIN32
|
#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;
|
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 access _access
|
||||||
# define F_OK 0
|
# define F_OK 0
|
||||||
# define W_OK 2
|
# define W_OK 2
|
||||||
@@ -90,12 +114,6 @@ typedef int ssize_t;
|
|||||||
# define stat _stat
|
# define stat _stat
|
||||||
# define unlink _unlink
|
# define unlink _unlink
|
||||||
#elif defined (__MINGW32__)
|
#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_IRGRP 0
|
||||||
# define S_IWGRP 0
|
# define S_IWGRP 0
|
||||||
# define S_IXGRP 0
|
# define S_IXGRP 0
|
||||||
@@ -110,12 +128,19 @@ typedef unsigned short mode_t;
|
|||||||
# define S_IFREG _S_IFREG
|
# define S_IFREG _S_IFREG
|
||||||
# define S_IFCHR _S_IFCHR
|
# define S_IFCHR _S_IFCHR
|
||||||
# define S_IFDIR _S_IFDIR
|
# 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
|
#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 */
|
#endif /* _UIOPORT_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user