Changeset - r9390:aab57f0a7820
[Not reviewed]
master
0 28 0
rubidium - 16 years ago 2008-05-27 21:41:00
rubidium@openttd.org
(svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings.
28 files changed with 88 insertions and 83 deletions:
0 comments (0 inline, 0 general)
src/animated_tile.cpp
Show inline comments
 
@@ -116,7 +116,7 @@ static void Load_ANIT()
 
		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;
src/cheat.cpp
Show inline comments
 
@@ -30,7 +30,7 @@ static void Save_CHTS()
 
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);
src/debug.cpp
Show inline comments
 
@@ -74,7 +74,7 @@ void CDECL debug(const char *dbg, ...)
 
		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 */
 
	{
src/fileio.cpp
Show inline comments
 
@@ -43,7 +43,7 @@ struct Fio {
 
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 @@ const char *FioGetFilename(uint8 slot)
 
	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;
src/fileio.h
Show inline comments
 
@@ -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();
src/minilzo.cpp
Show inline comments
 
@@ -1183,7 +1183,7 @@ m3_m4_offset:
 
			break;
 
	}
 

	
 
	*out_len = op - out;
 
	*out_len = (lzo_uint)(op - out);
 
	return pd(in_end,ii);
 
}
 

	
 
@@ -1233,7 +1233,7 @@ DO_COMPRESS	  ( const lzo_byte *in , lzo
 
	*op++ = 0;
 
	*op++ = 0;
 

	
 
	*out_len = op - out;
 
	*out_len = (lzo_uint)(op - out);
 
	return LZO_E_OK;
 
}
 

	
 
@@ -1555,7 +1555,7 @@ match_next:
 

	
 
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));
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -751,7 +751,7 @@ static void DelChar(Textbuf *tb, bool ba
 

	
 
	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 @@ void DeleteTextBufferAll(Textbuf *tb)
 
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 @@ bool MoveTextBufferPos(Textbuf *tb, int 
 
			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;
src/mixer.cpp
Show inline comments
 
@@ -104,7 +104,7 @@ MixerChannel *MxAllocateChannel()
 
	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 @@ void MxSetChannelRawSrc(MixerChannel *mc
 
	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)
src/mixer.h
Show inline comments
 
@@ -18,7 +18,7 @@ bool MxInitialize(uint rate);
 
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*);
 

	
src/newgrf.cpp
Show inline comments
 
@@ -3707,7 +3707,7 @@ static void CfgApply(byte *buf, size_t l
 
	 *                 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();
 

	
src/newgrf.h
Show inline comments
 
@@ -52,7 +52,7 @@ enum GrfSpecFeature {
 
struct GRFLabel {
 
	byte label;
 
	uint32 nfo_line;
 
	uint32 pos;
 
	size_t pos;
 
	struct GRFLabel *next;
 
};
 

	
src/order_cmd.cpp
Show inline comments
 
@@ -1836,7 +1836,7 @@ static void Load_ORDR()
 
	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)) {
src/saveload.cpp
Show inline comments
 
@@ -43,8 +43,8 @@ uint32 _ttdp_version;     ///< version o
 
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 @@ static struct {
 
	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 @@ void ProcessAsyncSaveFinish()
 
 */
 
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 @@ static void SlReadFill()
 
	_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 @@ static uint SlReadSimpleGamma()
 
 * @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 uint SlReadSparseIndex() {
 
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 @@ void SlSetArrayIndex(uint index)
 
	_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 @@ void SlSetLength(size_t length)
 
			 * 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 @@ void SlSetLength(size_t length)
 
		default: NOT_REACHED();
 
		} break;
 
	case NL_CALCLENGTH:
 
		_sl.obj_len += length;
 
		_sl.obj_len += (int)length;
 
		break;
 
	}
 
}
 
@@ -422,7 +422,7 @@ static inline void SlSkipBytes(size_t le
 
}
 

	
 
/* 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 @@ static void SlString(void *ptr, size_t l
 
 * @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 @@ static inline size_t SlCalcArrayLen(uint
 
 * @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 @@ void SlList(void *list, SLRefType conv)
 
	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 SlGlobList(const SaveLoadGlobVarLis
 
 */
 
void SlAutolength(AutolengthProc *proc, void *arg)
 
{
 
	uint32 offs;
 
	size_t offs;
 

	
 
	assert(_sl.save);
 

	
 
@@ -912,8 +912,8 @@ void SlAutolength(AutolengthProc *proc, 
 
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 @@ static void SlLoadChunks()
 

	
 
#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 @@ static uint ReadLZO()
 

	
 
/* 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 @@ static void UninitLZO()
 
/*********************************************
 
 ******** 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 @@ static void UnInitMem()
 
	_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 @@ static bool InitReadZlib()
 
	return true;
 
}
 

	
 
static uint ReadZlib()
 
static size_t ReadZlib()
 
{
 
	int r;
 

	
 
@@ -1237,13 +1237,13 @@ static bool InitWriteZlib()
 
	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 @@ static void WriteZlibLoop(z_streamp z, b
 
	} while (z->avail_in || !z->avail_out);
 
}
 

	
 
static void WriteZlib(uint len)
 
static void WriteZlib(size_t len)
 
{
 
	WriteZlibLoop(&_z, _sl.buf, len, 0);
 
}
src/saveload.h
Show inline comments
 
@@ -314,7 +314,7 @@ void SlSetArrayIndex(uint index);
 
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 @@ byte SlReadByte();
 
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);
 

	
src/sound.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ static void OpenBankFile(const char *fil
 
	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. */
src/sound_type.h
Show inline comments
 
@@ -20,8 +20,8 @@ struct MusicFileSettings {
 

	
 
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;
src/spritecache.cpp
Show inline comments
 
@@ -25,7 +25,7 @@ uint _sprite_cache_size = 4;
 
struct SpriteCache {
 
	void *ptr;
 
	uint32 id;
 
	uint32 file_pos;
 
	size_t file_pos;
 
	uint16 file_slot;
 
	int16 lru;
 
};
 
@@ -123,7 +123,7 @@ void* AllocSprite(size_t);
 
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 @@ static void* ReadSprite(SpriteCache *sc,
 
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 @@ static inline MemBlock* NextBlock(MemBlo
 
	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)) {
src/spriteloader/grf.cpp
Show inline comments
 
@@ -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);
src/spriteloader/grf.hpp
Show inline comments
 
@@ -12,7 +12,7 @@ public:
 
	/**
 
	 * 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 */
src/spriteloader/png.cpp
Show inline comments
 
@@ -170,11 +170,11 @@ static bool LoadPNG(SpriteLoader::Sprite
 
	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;
 
}
 

	
src/spriteloader/png.hpp
Show inline comments
 
@@ -12,7 +12,7 @@ public:
 
	/**
 
	 * 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 */
src/spriteloader/spriteloader.hpp
Show inline comments
 
@@ -26,7 +26,7 @@ public:
 
	/**
 
	 * 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() { }
 
};
src/station_gui.cpp
Show inline comments
 
@@ -682,7 +682,7 @@ typedef std::list<CargoData> CargoDataLi
 
 */
 
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 @@ struct StationViewWindow : public Window
 
				}
 
			}
 
		}
 
		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);
src/stdafx.h
Show inline comments
 
@@ -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 */
src/string_func.h
Show inline comments
 
@@ -81,7 +81,7 @@ static inline WChar Utf8Consume(const ch
 
 * @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 @@ static inline size_t Utf8CharLen(WChar c
 
 * @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;
src/town_gui.cpp
Show inline comments
 
@@ -464,7 +464,7 @@ private:
 
	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 @@ Listing TownDirectoryWindow::last_sortin
 
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,
 
};
src/widgets/dropdown.cpp
Show inline comments
 
@@ -274,7 +274,7 @@ void ShowDropDownList(Window *w, DropDow
 
		} 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 @@ void ShowDropDownList(Window *w, DropDow
 
		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;
src/win32.cpp
Show inline comments
 
@@ -1090,7 +1090,7 @@ bool InsertTextBufferClipboard(Textbuf *
 
	const char *ptr;
 

	
 
	WChar c;
 
	size_t width, length;
 
	uint16 width, length;
 

	
 
	if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
 
		OpenClipboard(NULL);
 
@@ -1122,7 +1122,7 @@ bool InsertTextBufferClipboard(Textbuf *
 
	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);
0 comments (0 inline, 0 general)