(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
authorrubidium
Tue, 27 May 2008 21:41:00 +0000
changeset 10751 ebd94f2d6385
parent 10749 b8ac8a8e27c4
child 10752 332994dbea4e
(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
src/animated_tile.cpp
src/cheat.cpp
src/debug.cpp
src/fileio.cpp
src/fileio.h
src/minilzo.cpp
src/misc_gui.cpp
src/mixer.cpp
src/mixer.h
src/newgrf.cpp
src/newgrf.h
src/order_cmd.cpp
src/saveload.cpp
src/saveload.h
src/sound.cpp
src/sound_type.h
src/spritecache.cpp
src/spriteloader/grf.cpp
src/spriteloader/grf.hpp
src/spriteloader/png.cpp
src/spriteloader/png.hpp
src/spriteloader/spriteloader.hpp
src/station_gui.cpp
src/stdafx.h
src/string_func.h
src/town_gui.cpp
src/widgets/dropdown.cpp
src/win32.cpp
--- a/src/animated_tile.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/animated_tile.cpp	Tue May 27 21:41:00 2008 +0000
@@ -116,7 +116,7 @@
 		return;
 	}
 
-	_animated_tile_count = SlGetFieldLength() / sizeof(*_animated_tile_list);
+	_animated_tile_count = (uint)SlGetFieldLength() / sizeof(*_animated_tile_list);
 
 	/* Determine a nice rounded size for the amount of allocated tiles */
 	_animated_tile_allocated = 256;
--- a/src/cheat.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/cheat.cpp	Tue May 27 21:41:00 2008 +0000
@@ -30,7 +30,7 @@
 static void Load_CHTS()
 {
 	Cheat *cht = (Cheat*)&_cheats;
-	uint count = SlGetFieldLength() / 2;
+	size_t count = SlGetFieldLength() / 2;
 
 	for (uint i = 0; i < count; i++) {
 		cht[i].been_used = (SlReadByte() != 0);
--- a/src/debug.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/debug.cpp	Tue May 27 21:41:00 2008 +0000
@@ -74,7 +74,7 @@
 		char buf2[lengthof(buf) + 32];
 
 		snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
-		send(_debug_socket, buf2, strlen(buf2), 0);
+		send(_debug_socket, buf2, (int)strlen(buf2), 0);
 	} else
 #endif /* ENABLE_NETWORK */
 	{
--- a/src/fileio.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/fileio.cpp	Tue May 27 21:41:00 2008 +0000
@@ -43,7 +43,7 @@
 static Fio _fio;
 
 /* Get current position in file */
-uint32 FioGetPos()
+size_t FioGetPos()
 {
 	return _fio.pos + (_fio.buffer - _fio.buffer_end);
 }
@@ -53,7 +53,7 @@
 	return _fio.shortnames[slot];
 }
 
-void FioSeekTo(uint32 pos, int mode)
+void FioSeekTo(size_t pos, int mode)
 {
 	if (mode == SEEK_CUR) pos += FioGetPos();
 	_fio.buffer = _fio.buffer_end = _fio.buffer_start + FIO_BUFFER_SIZE;
--- a/src/fileio.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/fileio.h	Tue May 27 21:41:00 2008 +0000
@@ -9,9 +9,9 @@
 #include <string>
 #include "core/enum_type.hpp"
 
-void FioSeekTo(uint32 pos, int mode);
-void FioSeekToFile(uint8 slot, uint32 pos);
-uint32 FioGetPos();
+void FioSeekTo(size_t pos, int mode);
+void FioSeekToFile(uint8 slot, size_t pos);
+size_t FioGetPos();
 const char *FioGetFilename(uint8 slot);
 byte FioReadByte();
 uint16 FioReadWord();
--- a/src/minilzo.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/minilzo.cpp	Tue May 27 21:41:00 2008 +0000
@@ -1183,7 +1183,7 @@
 			break;
 	}
 
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return pd(in_end,ii);
 }
 
@@ -1233,7 +1233,7 @@
 	*op++ = 0;
 	*op++ = 0;
 
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return LZO_E_OK;
 }
 
@@ -1555,7 +1555,7 @@
 
 eof_found:
 	assert(t == 1);
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return (ip == ip_end ? LZO_E_OK :
 		   (ip < ip_end  ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
 
--- a/src/misc_gui.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/misc_gui.cpp	Tue May 27 21:41:00 2008 +0000
@@ -751,7 +751,7 @@
 
 	if (backspace) s = Utf8PrevChar(s);
 
-	size_t len = Utf8Decode(&c, s);
+	uint16 len = (uint16)Utf8Decode(&c, s);
 	uint width = GetCharacterWidth(FS_NORMAL, c);
 
 	tb->width  -= width;
@@ -807,7 +807,7 @@
 bool InsertTextBufferChar(Textbuf *tb, WChar key)
 {
 	const byte charwidth = GetCharacterWidth(FS_NORMAL, key);
-	size_t len = Utf8CharLen(key);
+	uint16 len = (uint16)Utf8CharLen(key);
 	if (tb->length < (tb->maxlength - len) && (tb->maxwidth == 0 || tb->width + charwidth <= tb->maxwidth)) {
 		memmove(tb->buf + tb->caretpos + len, tb->buf + tb->caretpos, tb->length - tb->caretpos + 1);
 		Utf8Encode(tb->buf + tb->caretpos, key);
@@ -847,7 +847,7 @@
 			if (tb->caretpos < tb->length) {
 				WChar c;
 
-				tb->caretpos   += Utf8Decode(&c, tb->buf + tb->caretpos);
+				tb->caretpos   += (uint16)Utf8Decode(&c, tb->buf + tb->caretpos);
 				tb->caretxoffs += GetCharacterWidth(FS_NORMAL, c);
 
 				return true;
--- a/src/mixer.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/mixer.cpp	Tue May 27 21:41:00 2008 +0000
@@ -104,7 +104,7 @@
 	return NULL;
 }
 
-void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags)
+void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags)
 {
 	mc->memory = mem;
 	mc->flags = flags;
@@ -114,12 +114,12 @@
 	mc->frac_speed = (rate << 16) / _play_rate;
 
 	/* adjust the magnitude to prevent overflow */
-	while (size & 0xFFFF0000) {
+	while (size & ~0xFFFF) {
 		size >>= 1;
 		rate = (rate >> 1) + 1;
 	}
 
-	mc->samples_left = size * _play_rate / rate;
+	mc->samples_left = (uint)size * _play_rate / rate;
 }
 
 void MxSetChannelVolume(MixerChannel *mc, uint left, uint right)
--- a/src/mixer.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/mixer.h	Tue May 27 21:41:00 2008 +0000
@@ -18,7 +18,7 @@
 void MxMixSamples(void *buffer, uint samples);
 
 MixerChannel *MxAllocateChannel();
-void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags);
+void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags);
 void MxSetChannelVolume(MixerChannel *mc, uint left, uint right);
 void MxActivateChannel(MixerChannel*);
 
--- a/src/newgrf.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/newgrf.cpp	Tue May 27 21:41:00 2008 +0000
@@ -3707,7 +3707,7 @@
 	 *                 to place where parameter is to be stored. */
 
 	/* Preload the next sprite */
-	uint32 pos = FioGetPos();
+	size_t pos = FioGetPos();
 	uint16 num = FioReadWord();
 	uint8 type = FioReadByte();
 
--- a/src/newgrf.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/newgrf.h	Tue May 27 21:41:00 2008 +0000
@@ -52,7 +52,7 @@
 struct GRFLabel {
 	byte label;
 	uint32 nfo_line;
-	uint32 pos;
+	size_t pos;
 	struct GRFLabel *next;
 };
 
--- a/src/order_cmd.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/order_cmd.cpp	Tue May 27 21:41:00 2008 +0000
@@ -1836,7 +1836,7 @@
 	if (CheckSavegameVersionOldStyle(5, 2)) {
 		/* Version older than 5.2 did not have a ->next pointer. Convert them
 		    (in the old days, the orderlist was 5000 items big) */
-		uint len = SlGetFieldLength();
+		size_t len = SlGetFieldLength();
 		uint i;
 
 		if (CheckSavegameVersion(5)) {
--- a/src/saveload.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/saveload.cpp	Tue May 27 21:41:00 2008 +0000
@@ -43,8 +43,8 @@
 uint16 _sl_version;       ///< the major savegame version identifier
 byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 
-typedef void WriterProc(uint len);
-typedef uint ReaderProc();
+typedef void WriterProc(size_t len);
+typedef size_t ReaderProc();
 
 /** The saveload struct, containing reader-writer functions, bufffer, version, etc. */
 static struct {
@@ -53,10 +53,10 @@
 	byte block_mode;                     ///< ???
 	bool error;                          ///< did an error occur or not
 
-	int obj_len;                         ///< the length of the current object we are busy with
+	size_t obj_len;                      ///< the length of the current object we are busy with
 	int array_index, last_array_index;   ///< in the case of an array, the current and last positions
 
-	uint32 offs_base;                    ///< the offset in number of bytes since we started writing data (eg uncompressed savegame size)
+	size_t offs_base;                    ///< the offset in number of bytes since we started writing data (eg uncompressed savegame size)
 
 	WriterProc *write_bytes;             ///< savegame writer function
 	ReaderProc *read_bytes;              ///< savegame loader function
@@ -123,7 +123,7 @@
  */
 static void SlReadFill()
 {
-	uint len = _sl.read_bytes();
+	size_t len = _sl.read_bytes();
 	if (len == 0) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected end of chunk");
 
 	_sl.bufp = _sl.buf;
@@ -131,7 +131,7 @@
 	_sl.offs_base += len;
 }
 
-static inline uint32 SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
+static inline size_t SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
 
 /** Return the size in bytes of a certain type of normal/atomic variable
  * as it appears in memory. See VarTypes
@@ -283,27 +283,27 @@
  * @param i Index being written
  */
 
-static void SlWriteSimpleGamma(uint i)
+static void SlWriteSimpleGamma(size_t i)
 {
 	if (i >= (1 << 7)) {
 		if (i >= (1 << 14)) {
 			if (i >= (1 << 21)) {
 				assert(i < (1 << 28));
-				SlWriteByte((byte)0xE0 | (i >> 24));
+				SlWriteByte((byte)(0xE0 | (i >> 24)));
 				SlWriteByte((byte)(i >> 16));
 			} else {
-				SlWriteByte((byte)0xC0 | (i >> 16));
+				SlWriteByte((byte)(0xC0 | (i >> 16)));
 			}
 			SlWriteByte((byte)(i >> 8));
 		} else {
 			SlWriteByte((byte)(0x80 | (i >> 8)));
 		}
 	}
-	SlWriteByte(i);
+	SlWriteByte((byte)i);
 }
 
 /** Return how many bytes used to encode a gamma value */
-static inline uint SlGetGammaLength(uint i)
+static inline uint SlGetGammaLength(size_t i)
 {
 	return 1 + (i >= (1 << 7)) + (i >= (1 << 14)) + (i >= (1 << 21));
 }
@@ -312,8 +312,8 @@
 static inline void SlWriteSparseIndex(uint index) {SlWriteSimpleGamma(index);}
 
 static inline uint SlReadArrayLength() {return SlReadSimpleGamma();}
-static inline void SlWriteArrayLength(uint length) {SlWriteSimpleGamma(length);}
-static inline uint SlGetArrayLength(uint length) {return SlGetGammaLength(length);}
+static inline void SlWriteArrayLength(size_t length) {SlWriteSimpleGamma(length);}
+static inline uint SlGetArrayLength(size_t length) {return SlGetGammaLength(length);}
 
 void SlSetArrayIndex(uint index)
 {
@@ -321,7 +321,7 @@
 	_sl.array_index = index;
 }
 
-static uint32 _next_offs;
+static size_t _next_offs;
 
 /**
  * Iterate through the elements of an array and read the whole thing
@@ -375,7 +375,7 @@
 			 * The lower 24 bits are normal
 			 * The uppermost 4 bits are bits 24:27 */
 			assert(length < (1 << 28));
-			SlWriteUint32((length & 0xFFFFFF) | ((length >> 24) << 28));
+			SlWriteUint32((uint32)((length & 0xFFFFFF) | ((length >> 24) << 28)));
 			break;
 		case CH_ARRAY:
 			assert(_sl.last_array_index <= _sl.array_index);
@@ -390,7 +390,7 @@
 		default: NOT_REACHED();
 		} break;
 	case NL_CALCLENGTH:
-		_sl.obj_len += length;
+		_sl.obj_len += (int)length;
 		break;
 	}
 }
@@ -422,7 +422,7 @@
 }
 
 /* Get the length of the current object */
-uint SlGetFieldLength() {return _sl.obj_len;}
+size_t SlGetFieldLength() {return _sl.obj_len;}
 
 /** Return a signed-long version of the value of a setting
  * @param ptr pointer to the variable
@@ -628,7 +628,7 @@
  * @param length The length of the array counted in elements
  * @param conv VarType type of the variable that is used in calculating the size
  */
-static inline size_t SlCalcArrayLen(uint length, VarType conv)
+static inline size_t SlCalcArrayLen(size_t length, VarType conv)
 {
 	return SlCalcConvFileLen(conv) * length;
 }
@@ -639,7 +639,7 @@
  * @param length The length of the array in elements
  * @param conv VarType type of the atomic array (int, byte, uint64, etc.)
  */
-void SlArray(void *array, uint length, VarType conv)
+void SlArray(void *array, size_t length, VarType conv)
 {
 	/* Automatically calculate the length? */
 	if (_sl.need_length != NL_NONE) {
@@ -710,7 +710,7 @@
 	std::list<void *> *l = (std::list<void *> *) list;
 
 	if (_sl.save) {
-		SlWriteUint32(l->size());
+		SlWriteUint32((uint32)l->size());
 
 		std::list<void *>::iterator iter;
 		for (iter = l->begin(); iter != l->end(); ++iter) {
@@ -884,7 +884,7 @@
  */
 void SlAutolength(AutolengthProc *proc, void *arg)
 {
-	uint32 offs;
+	size_t offs;
 
 	assert(_sl.save);
 
@@ -912,8 +912,8 @@
 static void SlLoadChunk(const ChunkHandler *ch)
 {
 	byte m = SlReadByte();
-	uint32 len;
-	uint32 endoffs;
+	size_t len;
+	size_t endoffs;
 
 	_sl.block_mode = m;
 	_sl.obj_len = 0;
@@ -1052,7 +1052,7 @@
 
 #include "minilzo.h"
 
-static uint ReadLZO()
+static size_t ReadLZO()
 {
 	byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
 	uint32 tmp[2];
@@ -1085,13 +1085,13 @@
 
 /* p contains the pointer to the buffer, len contains the pointer to the length.
  * len bytes will be written, p and l will be updated to reflect the next buffer. */
-static void WriteLZO(uint size)
+static void WriteLZO(size_t size)
 {
 	byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
 	byte wrkmem[sizeof(byte*)*4096];
 	uint outlen;
 
-	lzo1x_1_compress(_sl.buf, size, out + sizeof(uint32)*2, &outlen, wrkmem);
+	lzo1x_1_compress(_sl.buf, (lzo_uint)size, out + sizeof(uint32)*2, &outlen, wrkmem);
 	((uint32*)out)[1] = TO_BE32(outlen);
 	((uint32*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32), outlen + sizeof(uint32)));
 	if (fwrite(out, outlen + sizeof(uint32)*2, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
@@ -1112,12 +1112,12 @@
 /*********************************************
  ******** START OF NOCOMP CODE (uncompressed)*
  *********************************************/
-static uint ReadNoComp()
+static size_t ReadNoComp()
 {
 	return fread(_sl.buf, 1, LZO_SIZE, _sl.fh);
 }
 
-static void WriteNoComp(uint size)
+static void WriteNoComp(size_t size)
 {
 	if (fwrite(_sl.buf, 1, size, _sl.fh) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
 }
@@ -1170,9 +1170,9 @@
 	_Savegame_pool.CleanPool();
 }
 
-static void WriteMem(uint size)
+static void WriteMem(size_t size)
 {
-	_ts.count += size;
+	_ts.count += (uint)size;
 	/* Allocate new block and new buffer-pointer */
 	_Savegame_pool.AddBlockIfNeeded(_ts.count);
 	_sl.buf = GetSavegame(_ts.count);
@@ -1197,7 +1197,7 @@
 	return true;
 }
 
-static uint ReadZlib()
+static size_t ReadZlib()
 {
 	int r;
 
@@ -1237,13 +1237,13 @@
 	return true;
 }
 
-static void WriteZlibLoop(z_streamp z, byte *p, uint len, int mode)
+static void WriteZlibLoop(z_streamp z, byte *p, size_t len, int mode)
 {
 	byte buf[1024]; // output buffer
 	int r;
 	uint n;
 	z->next_in = p;
-	z->avail_in = len;
+	z->avail_in = (uInt)len;
 	do {
 		z->next_out = buf;
 		z->avail_out = sizeof(buf);
@@ -1258,7 +1258,7 @@
 	} while (z->avail_in || !z->avail_out);
 }
 
-static void WriteZlib(uint len)
+static void WriteZlib(size_t len)
 {
 	WriteZlibLoop(&_z, _sl.buf, len, 0);
 }
--- a/src/saveload.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/saveload.h	Tue May 27 21:41:00 2008 +0000
@@ -314,7 +314,7 @@
 int SlIterateArray();
 
 void SlAutolength(AutolengthProc *proc, void *arg);
-uint SlGetFieldLength();
+size_t SlGetFieldLength();
 void SlSetLength(size_t length);
 size_t SlCalcObjMemberLength(const void *object, const SaveLoad *sld);
 
@@ -322,7 +322,7 @@
 void SlWriteByte(byte b);
 
 void SlGlobList(const SaveLoadGlobVarList *sldg);
-void SlArray(void *array, uint length, VarType conv);
+void SlArray(void *array, size_t length, VarType conv);
 void SlObject(void *object, const SaveLoad *sld);
 bool SlObjectMember(void *object, const SaveLoad *sld);
 
--- a/src/sound.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/sound.cpp	Tue May 27 21:41:00 2008 +0000
@@ -29,7 +29,7 @@
 	uint i;
 
 	FioOpenFile(SOUND_SLOT, filename);
-	uint pos = FioGetPos();
+	size_t pos = FioGetPos();
 	uint count = FioReadDword() / 8;
 
 	/* Simple check for the correct number of original sounds. */
--- a/src/sound_type.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/sound_type.h	Tue May 27 21:41:00 2008 +0000
@@ -20,8 +20,8 @@
 
 struct FileEntry {
 	uint8 file_slot;
-	uint32 file_offset;
-	uint32 file_size;
+	size_t file_offset;
+	size_t file_size;
 	uint16 rate;
 	uint8 bits_per_sample;
 	uint8 channels;
--- a/src/spritecache.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spritecache.cpp	Tue May 27 21:41:00 2008 +0000
@@ -25,7 +25,7 @@
 struct SpriteCache {
 	void *ptr;
 	uint32 id;
-	uint32 file_pos;
+	size_t file_pos;
 	uint16 file_slot;
 	int16 lru;
 };
@@ -123,7 +123,7 @@
 static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
 {
 	uint8 file_slot = sc->file_slot;
-	uint32 file_pos = sc->file_pos;
+	size_t file_pos = sc->file_pos;
 
 	DEBUG(sprite, 9, "Load sprite %d", id);
 
@@ -241,7 +241,7 @@
 bool LoadNextSprite(int load_index, byte file_slot, uint file_sprite_id)
 {
 	SpriteCache *sc;
-	uint32 file_pos = FioGetPos();
+	size_t file_pos = FioGetPos();
 
 	if (!ReadSpriteHeaderSkipData()) return false;
 
@@ -279,9 +279,9 @@
 	return (MemBlock*)((byte*)block + (block->size & ~S_FREE_MASK));
 }
 
-static uint32 GetSpriteCacheUsage()
+static size_t GetSpriteCacheUsage()
 {
-	uint32 tot_size = 0;
+	size_t tot_size = 0;
 	MemBlock* s;
 
 	for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
--- a/src/spriteloader/grf.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spriteloader/grf.cpp	Tue May 27 21:41:00 2008 +0000
@@ -9,7 +9,7 @@
 #include "../core/alloc_func.hpp"
 #include "grf.hpp"
 
-bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos)
 {
 	/* Open the right file and go to the correct position */
 	FioSeekToFile(file_slot, file_pos);
--- a/src/spriteloader/grf.hpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spriteloader/grf.hpp	Tue May 27 21:41:00 2008 +0000
@@ -12,7 +12,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
+	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos);
 };
 
 #endif /* SPRITELOADER_GRF_HPP */
--- a/src/spriteloader/png.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spriteloader/png.cpp	Tue May 27 21:41:00 2008 +0000
@@ -170,11 +170,11 @@
 	return true;
 }
 
-bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos)
 {
 	const char *filename = FioGetFilename(file_slot);
-	if (!LoadPNG(sprite, filename, file_pos, false)) return false;
-	if (!LoadPNG(sprite, filename, file_pos, true)) return false;
+	if (!LoadPNG(sprite, filename, (uint32)file_pos, false)) return false;
+	if (!LoadPNG(sprite, filename, (uint32)file_pos, true)) return false;
 	return true;
 }
 
--- a/src/spriteloader/png.hpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spriteloader/png.hpp	Tue May 27 21:41:00 2008 +0000
@@ -12,7 +12,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
+	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos);
 };
 
 #endif /* SPRITELOADER_PNG_HPP */
--- a/src/spriteloader/spriteloader.hpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/spriteloader/spriteloader.hpp	Tue May 27 21:41:00 2008 +0000
@@ -26,7 +26,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos) = 0;
+	virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos) = 0;
 
 	virtual ~SpriteLoader() { }
 };
--- a/src/station_gui.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/station_gui.cpp	Tue May 27 21:41:00 2008 +0000
@@ -682,7 +682,7 @@
  */
 struct StationViewWindow : public Window {
 	uint32 cargo;                 ///< Bitmask of cargo types to expand
-	uint16 cargo_rows[NUM_CARGO]; ///< Header row for each cargo type
+	size_t cargo_rows[NUM_CARGO]; ///< Header row for each cargo type
 
 	StationViewWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 	{
@@ -751,7 +751,7 @@
 				}
 			}
 		}
-		SetVScrollCount(this, cargolist.size() + 1); // update scrollbar
+		SetVScrollCount(this, (int)cargolist.size() + 1); // update scrollbar
 
 		/* disable some buttons */
 		this->SetWidgetDisabledState(SVW_RENAME,   st->owner != _local_player);
--- a/src/stdafx.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/stdafx.h	Tue May 27 21:41:00 2008 +0000
@@ -201,6 +201,11 @@
 		typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
 	#endif /* WIN32 && !_WIN64 && !WIN64 */
 
+	#if defined(_WIN64) || defined(WIN64)
+		#define fseek _fseeki64
+	#endif /* _WIN64 || WIN64 */
+
+
 	#define GCC_PACK
 
 	/* This is needed to zlib uses the stdcall calling convention on visual studio */
--- a/src/string_func.h	Tue May 27 20:33:44 2008 +0000
+++ b/src/string_func.h	Tue May 27 21:41:00 2008 +0000
@@ -81,7 +81,7 @@
  * @param c Unicode character.
  * @return Length of UTF-8 encoding for character.
  */
-static inline size_t Utf8CharLen(WChar c)
+static inline int8 Utf8CharLen(WChar c)
 {
 	if (c < 0x80)       return 1;
 	if (c < 0x800)      return 2;
@@ -100,7 +100,7 @@
  * @param c char to query length of
  * @return requested size
  */
-static inline size_t Utf8EncodedCharLen(char c)
+static inline int8 Utf8EncodedCharLen(char c)
 {
 	if (GB(c, 3, 5) == 0x1E) return 4;
 	if (GB(c, 4, 4) == 0x0E) return 3;
--- a/src/town_gui.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/town_gui.cpp	Tue May 27 21:41:00 2008 +0000
@@ -464,7 +464,7 @@
 	static const Town *last_town;
 
 	/* Constants for sorting towns */
-	static const GUITownList::SortFunction * const sorter_funcs[];
+	static GUITownList::SortFunction * const sorter_funcs[];
 
 	GUITownList towns;
 
@@ -637,7 +637,7 @@
 const Town *TownDirectoryWindow::last_town = NULL;
 
 /* Available town directory sorting functions */
-const GUITownList::SortFunction * const TownDirectoryWindow::sorter_funcs[] = {
+GUITownList::SortFunction * const TownDirectoryWindow::sorter_funcs[] = {
 	&TownNameSorter,
 	&TownPopulationSorter,
 };
--- a/src/widgets/dropdown.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/widgets/dropdown.cpp	Tue May 27 21:41:00 2008 +0000
@@ -274,7 +274,7 @@
 		} else {
 			/* ... and lastly if it won't, enable the scroll bar and fit the
 			 * list in below the widget */
-			int avg_height = list_height / list->size();
+			int avg_height = list_height / (int)list->size();
 			int rows = (screen_bottom - 4 - top) / avg_height;
 			height = rows * avg_height;
 			scroll = true;
@@ -306,8 +306,8 @@
 		dw->widget[0].right -= 12;
 
 		/* Capacity is the average number of items visible */
-		dw->vscroll.cap   = height * list->size() / list_height;
-		dw->vscroll.count = list->size();
+		dw->vscroll.cap   = height * (uint16)list->size() / list_height;
+		dw->vscroll.count = (uint16)list->size();
 	}
 
 	dw->desc_flags = WDF_DEF_WIDGET;
--- a/src/win32.cpp	Tue May 27 20:33:44 2008 +0000
+++ b/src/win32.cpp	Tue May 27 21:41:00 2008 +0000
@@ -1090,7 +1090,7 @@
 	const char *ptr;
 
 	WChar c;
-	size_t width, length;
+	uint16 width, length;
 
 	if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
 		OpenClipboard(NULL);
@@ -1122,7 +1122,7 @@
 	for (ptr = utf8_buf; (c = Utf8Consume(&ptr)) != '\0';) {
 		if (!IsPrintable(c)) break;
 
-		size_t len = Utf8CharLen(c);
+		byte len = Utf8CharLen(c);
 		if (tb->length + length >= tb->maxlength - len) break;
 
 		byte charwidth = GetCharacterWidth(FS_NORMAL, c);