Changeset - r21495:3c73d5d4f84b
[Not reviewed]
master
0 5 0
rubidium - 10 years ago 2014-05-24 17:58:32
rubidium@openttd.org
(svn r26609) -Fix: compile warnings on MSVC for 32 bits builds due to assigning values to variables with smaller integer size
5 files changed with 16 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
Show inline comments
 
@@ -537,7 +537,7 @@ SQFunctionProto *SQFuncState::BuildProto
 
	for(SQUnsignedInteger no = 0; no < _lineinfos.size(); no++) f->_lineinfos[no] = _lineinfos[no];
 
	for(SQUnsignedInteger no = 0; no < _defaultparams.size(); no++) f->_defaultparams[no] = _defaultparams[no];
 

	
 
	memcpy(f->_instructions,&_instructions[0],_instructions.size()*sizeof(SQInstruction));
 
	memcpy(f->_instructions,&_instructions[0],(size_t)_instructions.size()*sizeof(SQInstruction));
 

	
 
	f->_varparams = _varparams;
 

	
src/3rdparty/squirrel/squirrel/sqmem.cpp
Show inline comments
 
@@ -2,8 +2,8 @@
 
	see copyright notice in squirrel.h
 
*/
 
#include "sqpcheader.h"
 
void *sq_vm_malloc(SQUnsignedInteger size){	return malloc(size); }
 
void *sq_vm_malloc(SQUnsignedInteger size){	return malloc((size_t)size); }
 

	
 
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size){ return realloc(p, size); }
 
void *sq_vm_realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size){ return realloc(p, (size_t)size); }
 

	
 
void sq_vm_free(void *p, SQUnsignedInteger size){	free(p); }
src/3rdparty/squirrel/squirrel/sqstate.cpp
Show inline comments
 
@@ -507,26 +507,26 @@ void SQStringTable::AllocNodes(SQInteger
 
{
 
	_numofslots = size;
 
	_strings = (SQString**)SQ_MALLOC(sizeof(SQString*)*_numofslots);
 
	memset(_strings,0,sizeof(SQString*)*_numofslots);
 
	memset(_strings,0,sizeof(SQString*)*(size_t)_numofslots);
 
}
 

	
 
SQString *SQStringTable::Add(const SQChar *news,SQInteger len)
 
{
 
	if(len<0)
 
		len = (SQInteger)scstrlen(news);
 
	SQHash h = ::_hashstr(news,len)&(_numofslots-1);
 
	SQHash h = ::_hashstr(news,(size_t)len)&(_numofslots-1);
 
	SQString *s;
 
	for (s = _strings[h]; s; s = s->_next){
 
		if(s->_len == len && (!memcmp(news,s->_val,rsl(len))))
 
		if(s->_len == len && (!memcmp(news,s->_val,(size_t)rsl(len))))
 
			return s; //found
 
	}
 

	
 
	SQString *t=(SQString *)SQ_MALLOC(rsl(len)+sizeof(SQString));
 
	new (t) SQString;
 
	memcpy(t->_val,news,rsl(len));
 
	memcpy(t->_val,news,(size_t)rsl(len));
 
	t->_val[len] = _SC('\0');
 
	t->_len = len;
 
	t->_hash = ::_hashstr(news,len);
 
	t->_hash = ::_hashstr(news,(size_t)len);
 
	t->_next = _strings[h];
 
	_strings[h] = t;
 
	_slotused++;
src/3rdparty/squirrel/squirrel/squtils.h
Show inline comments
 
@@ -41,7 +41,7 @@ public:
 
		        size_t allocated_size = _allocated * sizeof(T);
 
		        _allocated = 0;
 

	
 
			for(SQUnsignedInteger i = 0; i < _size; i++)
 
			for(size_t i = 0; i < _size; i++)
 
				_vals[i].~T();
 
			SQ_FREE(_vals, allocated_size);
 
		}
 
@@ -61,7 +61,7 @@ public:
 
			for(SQUnsignedInteger i = newsize; i < _size; i++) {
 
				_vals[i].~T();
 
			}
 
			_size = newsize;
 
			_size = (size_t)newsize;
 
		}
 
	}
 
	void shrinktofit() { if(_size > 4) { _realloc(_size); } }
 
@@ -90,7 +90,7 @@ public:
 
	{
 
		_vals[idx].~T();
 
		if(idx < (_size - 1)) {
 
			memmove(&_vals[idx], &_vals[idx+1], sizeof(T) * (_size - idx - 1));
 
			memmove(&_vals[idx], &_vals[idx+1], sizeof(T) * (_size - (size_t)idx - 1));
 
		}
 
		_size--;
 
	}
 
@@ -103,10 +103,10 @@ private:
 
	{
 
		newsize = (newsize > 0)?newsize:4;
 
		_vals = (T*)SQ_REALLOC(_vals, _allocated * sizeof(T), newsize * sizeof(T));
 
		_allocated = newsize;
 
		_allocated = (size_t)newsize;
 
	}
 
	SQUnsignedInteger _size;
 
	SQUnsignedInteger _allocated;
 
	size_t _size;
 
	size_t _allocated;
 
};
 

	
 
#endif //_SQUTILS_H_
src/3rdparty/squirrel/squirrel/sqvm.cpp
Show inline comments
 
@@ -289,8 +289,8 @@ bool SQVM::StringCat(const SQObjectPtr &
 
	ToString(obj, b);
 
	SQInteger l = _string(a)->_len , ol = _string(b)->_len;
 
	SQChar *s = _sp(rsl(l + ol + 1));
 
	memcpy(s, _stringval(a), rsl(l));
 
	memcpy(s + l, _stringval(b), rsl(ol));
 
	memcpy(s, _stringval(a), (size_t)rsl(l));
 
	memcpy(s + l, _stringval(b), (size_t)rsl(ol));
 
	dest = SQString::Create(_ss(this), _spval, l + ol);
 
	return true;
 
}
0 comments (0 inline, 0 general)