From 95a56b1d1e85e8cfabe2035c90c072f50acc1806 Mon Sep 17 00:00:00 2001 From: anyc Date: Tue, 20 May 2014 12:49:27 +0200 Subject: [PATCH] make code compatible with mingw64 --- src/park.c | 1 + src/rct2.c | 4 ++-- src/rct2.h | 2 +- src/ride.c | 1 + src/sawyercoding.c | 4 ++-- src/title.c | 1 + src/widget.c | 1 + src/window_about.c | 1 + src/window_cheats.c | 2 ++ src/window_dropdown.c | 1 + src/window_game_bottom_toolbar.c | 1 + src/window_tooltip.c | 1 + 12 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/park.c b/src/park.c index bb7413f0fa..7fc5d11c55 100644 --- a/src/park.c +++ b/src/park.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include "addresses.h" #include "finance.h" #include "map.h" diff --git a/src/rct2.c b/src/rct2.c index e3ac83c096..d857b093ac 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include "addresses.h" #include "climate.h" @@ -338,7 +338,7 @@ void get_system_info() RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PAGEFILE, uint32) = memInfo.dwTotalPageFile; RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_VIRTUAL, uint32) = memInfo.dwTotalVirtual; - uint32 size = 80; + DWORD size = 80; GetUserName((char*)RCT2_ADDRESS_OS_USER_NAME, &size); size = 80; GetComputerName((char*)RCT2_ADDRESS_OS_COMPUTER_NAME, &size); diff --git a/src/rct2.h b/src/rct2.h index d0a75a23ed..41c49d30d2 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -44,7 +44,7 @@ typedef unsigned long long uint64; #define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0)) #define clamp(l, x, h) (min(h, max(l, x))) -#define countof(x) _countof(x) +#define countof(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) void rct2_finish(); diff --git a/src/ride.c b/src/ride.c index 42f32287ff..7490f60dd3 100644 --- a/src/ride.c +++ b/src/ride.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include "addresses.h" #include "ride.h" #include "sprite.h" diff --git a/src/sawyercoding.c b/src/sawyercoding.c index f62483f5c2..3b56e5806c 100644 --- a/src/sawyercoding.c +++ b/src/sawyercoding.c @@ -111,7 +111,7 @@ int sawyercoding_read_chunk(HANDLE hFile, uint8 *buffer) static int decode_chunk_rle(char *buffer, int length) { int i, j, count; - uint8 *src, *dst, rleCodeByte; + char *src, *dst, rleCodeByte; // Backup buffer src = malloc(length); @@ -145,7 +145,7 @@ static int decode_chunk_rle(char *buffer, int length) static int decode_chunk_repeat(char *buffer, int length) { int i, j, count; - uint8 *src, *dst, *copyOffset; + char *src, *dst, *copyOffset; // Backup buffer src = malloc(length); diff --git a/src/title.c b/src/title.c index 5240805f3b..d351270bc9 100644 --- a/src/title.c +++ b/src/title.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include #include "addresses.h" diff --git a/src/widget.c b/src/widget.c index 33be565a97..cae3647fc0 100644 --- a/src/widget.c +++ b/src/widget.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include #include "addresses.h" diff --git a/src/window_about.c b/src/window_about.c index d659b7c5f0..36159bdce0 100644 --- a/src/window_about.c +++ b/src/window_about.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include "addresses.h" #include "string_ids.h" diff --git a/src/window_cheats.c b/src/window_cheats.c index 7974617fbb..0a18ff0ada 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -18,7 +18,9 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include +#include #include "addresses.h" #include "park.h" #include "peep.h" diff --git a/src/window_dropdown.c b/src/window_dropdown.c index 59bd42a92a..4b552e7d80 100644 --- a/src/window_dropdown.c +++ b/src/window_dropdown.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include "addresses.h" #include "scenario.h" diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index e8c3a1ab22..3966c3904f 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include "addresses.h" #include "climate.h" diff --git a/src/window_tooltip.c b/src/window_tooltip.c index 643671f568..fc8ebbb22f 100644 --- a/src/window_tooltip.c +++ b/src/window_tooltip.c @@ -18,6 +18,7 @@ * along with this program. If not, see . *****************************************************************************/ +#include #include #include "addresses.h" #include "string_ids.h"