summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-01 11:52:44 +0000
committerhackykid <hackykid@openttd.org>2005-06-01 11:52:44 +0000
commitf7dcd2e834c28e7b4e4ba6e7833cf79c3b97b335 (patch)
tree85ffc0991699f19e38f7e937f8b493274594c341
parent351d7aaa9fd2fe1e5cd464130186727df38e646f (diff)
downloadopenttd-f7dcd2e834c28e7b4e4ba6e7833cf79c3b97b335.tar.xz
(svn r2390) - Codechange: Fix some warnings on GCC 4.0.0
-rw-r--r--economy.c2
-rw-r--r--macros.h2
-rw-r--r--md5.c4
-rw-r--r--md5.h2
-rw-r--r--music_gui.c8
-rw-r--r--order.h1
-rw-r--r--order_cmd.c1
-rw-r--r--rail_gui.c6
-rw-r--r--saveload.c2
-rw-r--r--tunnelbridge_cmd.c2
10 files changed, 18 insertions, 12 deletions
diff --git a/economy.c b/economy.c
index bd42320f3..03df70124 100644
--- a/economy.c
+++ b/economy.c
@@ -656,7 +656,7 @@ static void AddInflation(void)
inf = _economy.infl_amount_pr * 54;
for(i=0; i!=NUM_CARGO; i++) {
AddSingleInflation(
- _cargo_payment_rates + i,
+ (int32*)_cargo_payment_rates + i,
_cargo_payment_rates_frac + i,
inf
);
diff --git a/macros.h b/macros.h
index eb11b8a5c..bacd9ceb7 100644
--- a/macros.h
+++ b/macros.h
@@ -131,6 +131,8 @@ static inline int KillFirstBit2x64(int value)
static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
#define intswap(a,b) ((b) = intxchg_(&(a), (b)))
+static inline int uintxchg_(uint *a, uint b) { uint t = *a; *a = b; return t; }
+#define uintswap(a,b) ((b) = uintxchg_(&(a), (b)))
static inline int myabs(int a) { if (a<0) a = -a; return a; }
static inline int64 myabs64(int64 a) { if (a<0) a = -a; return a; }
diff --git a/md5.c b/md5.c
index 03d492c91..2c63ee876 100644
--- a/md5.c
+++ b/md5.c
@@ -321,9 +321,9 @@ md5_init(md5_state_t *pms)
}
void
-md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
+md5_append(md5_state_t *pms, const void *data, int nbytes)
{
- const md5_byte_t *p = data;
+ const md5_byte_t *p = (const md5_byte_t *)data;
int left = nbytes;
int offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
diff --git a/md5.h b/md5.h
index 3baa4dcdf..223f24ecf 100644
--- a/md5.h
+++ b/md5.h
@@ -79,7 +79,7 @@ extern "C"
void md5_init(md5_state_t *pms);
/* Append a string to the message. */
-void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
+void md5_append(md5_state_t *pms, const void *data, int nbytes);
/* Finish the message and return the digest. */
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
diff --git a/music_gui.c b/music_gui.c
index 42a807579..459689736 100644
--- a/music_gui.c
+++ b/music_gui.c
@@ -121,10 +121,12 @@ static void DoStopMusic(void)
static void SelectSongToPlay(void)
{
- int i;
+ int i = 0;
- memset(_cur_playlist, 0, 33);
- strcpy(_cur_playlist, _playlists[msf.playlist]);
+ do {
+ _cur_playlist[i] = _playlists[msf.playlist][i];
+ } while ( _cur_playlist[i++] != 0);
+ memset(_cur_playlist + i, 0, 33 - i);
if (msf.shuffle) {
i = 500;
diff --git a/order.h b/order.h
index 94eb7a6c4..5bce2bcde 100644
--- a/order.h
+++ b/order.h
@@ -137,6 +137,7 @@ static inline Order UnpackOrder(uint32 packed)
order.flags = (packed & 0x0000FF00) >> 8;
order.station = (packed & 0xFFFF0000) >> 16;
order.next = NULL;
+ order.index = 0; // avoid compiler warning
return order;
}
diff --git a/order_cmd.c b/order_cmd.c
index b0f8a3c67..f068d15ab 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -67,6 +67,7 @@ Order UnpackVersion4Order(uint16 packed)
order.flags = (packed & 0x00F0) >> 4;
order.station = (packed & 0xFF00) >> 8;
order.next = NULL;
+ order.index = 0; // avoid compiler warning
return order;
}
diff --git a/rail_gui.c b/rail_gui.c
index f4f5e4f15..9734c138f 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -627,11 +627,11 @@ static void HandleStationPlacement(uint start, uint end)
uint ey = TileY(end);
uint w,h;
- if (sx > ex) intswap(sx,ex);
- if (sy > ey) intswap(sy,ey);
+ if (sx > ex) uintswap(sx,ex);
+ if (sy > ey) uintswap(sy,ey);
w = ex - sx + 1;
h = ey - sy + 1;
- if (!_railstation.orientation) intswap(w,h);
+ if (!_railstation.orientation) uintswap(w,h);
// TODO: Custom station selector GUI. Now we just try using first custom station
// (and fall back to normal stations if it isn't available).
diff --git a/saveload.c b/saveload.c
index 19402f6c9..f22d7a078 100644
--- a/saveload.c
+++ b/saveload.c
@@ -878,7 +878,7 @@ static bool InitWriteZlib(void)
static void WriteZlibLoop(z_streamp z, byte *p, uint len, int mode)
{
- char buf[1024]; // output buffer
+ byte buf[1024]; // output buffer
int r;
uint n;
z->next_in = p;
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 3fd0c92ca..b489f43a7 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1153,7 +1153,7 @@ static uint GetSlopeZ_TunnelBridge(TileInfo *ti) {
uint y = ti->y & 0xF;
// swap directions if Y tunnel/bridge to let the code handle the X case only.
- if (ti->map5 & 1) intswap(x,y);
+ if (ti->map5 & 1) uintswap(x,y);
// to the side of the tunnel/bridge?
if (IS_INT_INSIDE(y, 5, 10+1)) {