# HG changeset patch # User hackykid # Date 1117626764 0 # Node ID 804ff5f94ed08e24338bfdf7610d5697d1b3e41b # Parent ad68cd0a0a259084b8c75311d243eae9843b3b5b (svn r2390) - Codechange: Fix some warnings on GCC 4.0.0 diff -r ad68cd0a0a25 -r 804ff5f94ed0 economy.c --- a/economy.c Wed Jun 01 11:34:37 2005 +0000 +++ b/economy.c Wed Jun 01 11:52:44 2005 +0000 @@ -656,7 +656,7 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 macros.h --- a/macros.h Wed Jun 01 11:34:37 2005 +0000 +++ b/macros.h Wed Jun 01 11:52:44 2005 +0000 @@ -131,6 +131,8 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 md5.c --- a/md5.c Wed Jun 01 11:34:37 2005 +0000 +++ b/md5.c Wed Jun 01 11:52:44 2005 +0000 @@ -321,9 +321,9 @@ } 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 -r ad68cd0a0a25 -r 804ff5f94ed0 md5.h --- a/md5.h Wed Jun 01 11:34:37 2005 +0000 +++ b/md5.h Wed Jun 01 11:52:44 2005 +0000 @@ -79,7 +79,7 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 music_gui.c --- a/music_gui.c Wed Jun 01 11:34:37 2005 +0000 +++ b/music_gui.c Wed Jun 01 11:52:44 2005 +0000 @@ -121,10 +121,12 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 order.h --- a/order.h Wed Jun 01 11:34:37 2005 +0000 +++ b/order.h Wed Jun 01 11:52:44 2005 +0000 @@ -137,6 +137,7 @@ order.flags = (packed & 0x0000FF00) >> 8; order.station = (packed & 0xFFFF0000) >> 16; order.next = NULL; + order.index = 0; // avoid compiler warning return order; } diff -r ad68cd0a0a25 -r 804ff5f94ed0 order_cmd.c --- a/order_cmd.c Wed Jun 01 11:34:37 2005 +0000 +++ b/order_cmd.c Wed Jun 01 11:52:44 2005 +0000 @@ -67,6 +67,7 @@ order.flags = (packed & 0x00F0) >> 4; order.station = (packed & 0xFF00) >> 8; order.next = NULL; + order.index = 0; // avoid compiler warning return order; } diff -r ad68cd0a0a25 -r 804ff5f94ed0 rail_gui.c --- a/rail_gui.c Wed Jun 01 11:34:37 2005 +0000 +++ b/rail_gui.c Wed Jun 01 11:52:44 2005 +0000 @@ -627,11 +627,11 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 saveload.c --- a/saveload.c Wed Jun 01 11:34:37 2005 +0000 +++ b/saveload.c Wed Jun 01 11:52:44 2005 +0000 @@ -878,7 +878,7 @@ 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 -r ad68cd0a0a25 -r 804ff5f94ed0 tunnelbridge_cmd.c --- a/tunnelbridge_cmd.c Wed Jun 01 11:34:37 2005 +0000 +++ b/tunnelbridge_cmd.c Wed Jun 01 11:52:44 2005 +0000 @@ -1153,7 +1153,7 @@ 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)) {