diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-09 00:46:55 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-09 00:46:55 +0000 |
commit | cc716ca00420c23bdb02831f8fc205d4588e1f75 (patch) | |
tree | b7f3182f6e59f705eff9ee14ad35075fa52acf80 /src/common | |
parent | 4ae1b3c2a335d95a5425ecf5c19c5be2ab21e13a (diff) | |
download | hercules-cc716ca00420c23bdb02831f8fc205d4588e1f75.tar.gz hercules-cc716ca00420c23bdb02831f8fc205d4588e1f75.tar.bz2 hercules-cc716ca00420c23bdb02831f8fc205d4588e1f75.tar.xz hercules-cc716ca00420c23bdb02831f8fc205d4588e1f75.zip |
* Played around with MinGW a bit today...
- adjusted code so that it handles mingw-specific compatibility problems
- adjusted the makefile, mingw is not a subset of cygwin
* As an experiment Corrected many /W4 warnings on the txt login server
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10192 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/cbasetypes.h | 6 | ||||
-rw-r--r-- | src/common/core.c | 1 | ||||
-rw-r--r-- | src/common/grfio.c | 1 | ||||
-rw-r--r-- | src/common/showmsg.c | 7 | ||||
-rw-r--r-- | src/common/socket.c | 4 | ||||
-rw-r--r-- | src/common/strlib.c | 3 | ||||
-rw-r--r-- | src/common/strlib.h | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 9eef2d6e5..e8af6bc9c 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -29,6 +29,10 @@ #define WIN32 #endif +#if defined(__MINGW32__) && !defined(MINGW) +#define MINGW +#endif + // __APPLE__ is the only predefined macro on MacOS X #if defined(__APPLE__) #define __DARWIN__ @@ -306,7 +310,7 @@ typedef char bool; ////////////////////////////////////////////////////////////////////////// // Has to be unsigned to avoid problems in some systems // Problems arise when these functions expect an argument in the range [0,256[ and are feed a signed char. -// NOTE: <ctype.h> needs to be included when using these defines +#include <ctype.h> #define ISALNUM(c) (isalnum((unsigned char)(c))) #define ISALPHA(c) (isalpha((unsigned char)(c))) #define ISCNTRL(c) (iscntrl((unsigned char)(c))) diff --git a/src/common/core.c b/src/common/core.c index 17aaa7b3c..a0a6b4f16 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -8,7 +8,6 @@ #endif #include <signal.h> #include <string.h> -#include <ctype.h> #include "core.h" #include "../common/mmo.h" diff --git a/src/common/grfio.c b/src/common/grfio.c index a2d7f7f5a..b15b37018 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -4,7 +4,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <sys/stat.h> #include "grfio.h" diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 58c26ac8a..c61530204 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -27,7 +27,6 @@ #endif #else #include <unistd.h> - #include <ctype.h> #ifdef DEBUGLOGMAP #define DEBUGLOGPATH "log/map-server.log" @@ -400,8 +399,8 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) // \033[#;#f - Horizontal & Vertical Position // The first # specifies the line number, the second # specifies the column. // The default for both is 1 - info.dwCursorPosition.X = (numbers[numpoint])?(numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F-1):0; - info.dwCursorPosition.Y = (numpoint && numbers[numpoint-1])?(numbers[numpoint-1]>>4)*10+(numbers[numpoint-1]&0x0F-1):0; + info.dwCursorPosition.X = (numbers[numpoint])?(numbers[numpoint]>>4)*10+((numbers[numpoint]&0x0F)-1):0; + info.dwCursorPosition.Y = (numpoint && numbers[numpoint-1])?(numbers[numpoint-1]>>4)*10+((numbers[numpoint-1]&0x0F)-1):0; if( info.dwCursorPosition.X >= info.dwSize.X ) info.dwCursorPosition.Y = info.dwSize.X-1; if( info.dwCursorPosition.Y >= info.dwSize.Y ) info.dwCursorPosition.Y = info.dwSize.Y-1; @@ -480,7 +479,7 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) else if( *q == 'G' ) { // \033[#G - Cursor Horizontal Absolute (CHA) // Moves the cursor to indicated column in current row. - info.dwCursorPosition.X = (numbers[numpoint])?(numbers[numpoint]>>4)*10+(numbers[numpoint]&0x0F-1):0; + info.dwCursorPosition.X = (numbers[numpoint])?(numbers[numpoint]>>4)*10+((numbers[numpoint]&0x0F)-1):0; if( info.dwCursorPosition.X >= info.dwSize.X ) info.dwCursorPosition.X = info.dwSize.X-1; diff --git a/src/common/socket.c b/src/common/socket.c index 6d89b26e6..34c707827 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -81,7 +81,7 @@ int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseFunc fun #ifndef MINICORE int ip_rules = 1; - static int connect_check(unsigned int ip); + static int connect_check(uint32 ip); #endif @@ -111,7 +111,7 @@ void set_nonblocking(int fd, int yes) // FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s. // The argp parameter is zero if nonblocking is to be disabled. - if (ioctlsocket(fd, FIONBIO, &yes) != 0) + if (ioctlsocket(fd, FIONBIO, (unsigned long*)&yes) != 0) ShowError("Couldn't set the socket to non-blocking mode (code %d)!\n", s_errno); } diff --git a/src/common/strlib.c b/src/common/strlib.c index 0ad0575f7..bd49e7b61 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -4,7 +4,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include "strlib.h" #include "../common/cbasetypes.h" @@ -198,7 +197,7 @@ char* _strtok_r(char *s1, const char *s2, char **lasts) } #endif -#if !defined(WIN32) || (defined(_MSC_VER) && _MSC_VER < 1400) +#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) /* Find the length of STRING, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ size_t strnlen (const char* string, size_t maxlen) diff --git a/src/common/strlib.h b/src/common/strlib.h index baaf244d7..bf26c2172 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -18,7 +18,7 @@ const char *stristr(const char *haystack, const char *needle); char* _strtok_r(char* s1, const char* s2, char** lasts); #endif -#if !defined(WIN32) || (defined(_MSC_VER) && _MSC_VER < 1400) +#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) size_t strnlen (const char* string, size_t maxlen); #endif |