summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-05-24 17:58:32 +0000
committerrubidium <rubidium@openttd.org>2014-05-24 17:58:32 +0000
commit8e87ae9120351bb9c9135328b57f5034be028b58 (patch)
tree3c45236e93418bb18b0aca02e7094bfa24bdeb1e
parent0b570aae1a032a764fbb53935c95440f9692ef00 (diff)
downloadopenttd-8e87ae9120351bb9c9135328b57f5034be028b58.tar.xz
(svn r26609) -Fix: compile warnings on MSVC for 32 bits builds due to assigning values to variables with smaller integer size
-rw-r--r--src/3rdparty/squirrel/squirrel/sqfuncstate.cpp2
-rw-r--r--src/3rdparty/squirrel/squirrel/sqmem.cpp4
-rw-r--r--src/3rdparty/squirrel/squirrel/sqstate.cpp10
-rw-r--r--src/3rdparty/squirrel/squirrel/squtils.h12
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.cpp4
5 files changed, 16 insertions, 16 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
index f48185377..fd8caf2e4 100644
--- a/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
@@ -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;
diff --git a/src/3rdparty/squirrel/squirrel/sqmem.cpp b/src/3rdparty/squirrel/squirrel/sqmem.cpp
index 6faf8165a..26d07047e 100644
--- a/src/3rdparty/squirrel/squirrel/sqmem.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqmem.cpp
@@ -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); }
diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp
index 45b533776..659d59c17 100644
--- a/src/3rdparty/squirrel/squirrel/sqstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp
@@ -507,26 +507,26 @@ void SQStringTable::AllocNodes(SQInteger size)
{
_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++;
diff --git a/src/3rdparty/squirrel/squirrel/squtils.h b/src/3rdparty/squirrel/squirrel/squtils.h
index 111a1c383..28c6cbec2 100644
--- a/src/3rdparty/squirrel/squirrel/squtils.h
+++ b/src/3rdparty/squirrel/squirrel/squtils.h
@@ -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_
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index f7c6f4d13..6f2894774 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -289,8 +289,8 @@ bool SQVM::StringCat(const SQObjectPtr &str,const SQObjectPtr &obj,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;
}