A few typecasts to enable / simplify 64-bit compilation

git-svn-id: svn://ultimatepp.org/upp/trunk@1653 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
rylek 2009-10-22 20:32:41 +00:00
parent 4d38ee9d2d
commit 816ac590d9
3 changed files with 11 additions and 11 deletions

View file

@ -1000,7 +1000,7 @@ template <class II, class VI, class K, class Less>
inline void __IndexSort(II begin, II end, VI pair, const Less& less, const K *) inline void __IndexSort(II begin, II end, VI pair, const Less& less, const K *)
{ {
Sort(IndexSortIterator<II, VI, K>(begin, pair), Sort(IndexSortIterator<II, VI, K>(begin, pair),
IndexSortIterator<II, VI, K>(end, pair + (end - begin)), IndexSortIterator<II, VI, K>(end, pair + (int)(ptrdiff_t)(end - begin)),
less); less);
} }

View file

@ -506,7 +506,7 @@ void PolygonIterator<T>::Add(typename PIUtils<T>::ConstIterator vertices, int ve
ue--; ue--;
} }
typename PIUtils<T>::PointList& seg1 = segments.Add(); typename PIUtils<T>::PointList& seg1 = segments.Add();
seg1.SetCount(degen1 ? 2 : ue - ub + 1 + (ue > ub ? 0 : *counts)); seg1.SetCount(degen1 ? 2 : (int)(ue - ub) + 1 + (ue > ub ? 0 : *counts));
ASSERT(seg1.GetCount() >= 2); ASSERT(seg1.GetCount() >= 2);
ASSERT(ub != e); ASSERT(ub != e);
typename PIUtils<T>::Iterator sp = seg1.End(); typename PIUtils<T>::Iterator sp = seg1.End();
@ -575,7 +575,7 @@ void PolygonIterator<T>::Add(typename PIUtils<T>::ConstIterator vertices, int ve
ue--; ue--;
} }
typename PIUtils<T>::PointList& seg2 = segments.Add(); typename PIUtils<T>::PointList& seg2 = segments.Add();
seg2.SetCount(degen2 ? 2 : ue - ub + 1 + (ue > ub ? 0 : *counts)); seg2.SetCount(degen2 ? 2 : (int)(ue - ub) + 1 + (ue > ub ? 0 : *counts));
ASSERT(seg2.GetCount() >= 2); ASSERT(seg2.GetCount() >= 2);
sp = seg2.Begin(); sp = seg2.Begin();
if(degen2) if(degen2)
@ -965,7 +965,7 @@ void PolygonIterator<T>::Flush(int index, T ypos)
typename PIUtils<T>::ConstIterator qb = q.done.Begin(); typename PIUtils<T>::ConstIterator qb = q.done.Begin();
if(*qb == p.done[0] && qb < qe) if(*qb == p.done[0] && qb < qe)
qb++; qb++;
out_vertices.SetCountR(out_vertices.GetCount() + (qe - qb)); out_vertices.SetCountR(out_vertices.GetCount() + (int)(qe - qb));
typename PIUtils<T>::Iterator out = out_vertices.End(); typename PIUtils<T>::Iterator out = out_vertices.End();
while(qb < qe) while(qb < qe)
*--out = *qb++; *--out = *qb++;

View file

@ -125,7 +125,7 @@ DbfStream::Field::Field(const char *_name, char type, byte width, byte decimal)
{ {
if(_name) { if(_name) {
const char *p = reinterpret_cast<const char *>(memchr(_name, 0, 11)); const char *p = reinterpret_cast<const char *>(memchr(_name, 0, 11));
name = String(_name, p ? p - _name : 11); name = String(_name, p ? (int)(p - _name) : 11);
} }
name = ToUpper(name); name = ToUpper(name);
} }
@ -604,7 +604,7 @@ bool DbfStream::Fetch(int row)
dbf.Seek(data_offset + row * record.GetCount()); dbf.Seek(data_offset + row * record.GetCount());
byte *p = record.Begin(), *e = record.End(); byte *p = record.Begin(), *e = record.End();
int count = dbf.Get(p, e - p); int count = dbf.Get(p, (int)(e - p));
if(count < record.GetCount()) if(count < record.GetCount())
memset(p + count, ' ', record.GetCount() - count); memset(p + count, ' ', record.GetCount() - count);
if(count <= 0 || (*p != ' ' && *p != 0)) { if(count <= 0 || (*p != ' ' && *p != 0)) {
@ -750,7 +750,7 @@ void DbfStream::DumpData(Stream& stream)
int i; int i;
for(i = 0; i < fields.GetCount(); i++) { for(i = 0; i < fields.GetCount(); i++) {
const Field& field = GetField(i); const Field& field = GetField(i);
int width = max<int>(field.width, strlen(field.name)); int width = max<int>(field.width, (int)strlen(field.name));
switch(field.type) { switch(field.type) {
case 'D': width = max(width, 10); break; case 'D': width = max(width, 10); break;
} }
@ -843,7 +843,7 @@ Value DbfStream::GetItemString(int i) const
p++; p++;
while(e > p && e[-1] == ' ') while(e > p && e[-1] == ' ')
e--; e--;
String s(p, e - p); String s(p, (int)(e - p));
if(charset == GetDefaultCharset()) if(charset == GetDefaultCharset())
return s; return s;
return ToUnicode(s, charset); return ToUnicode(s, charset);
@ -920,8 +920,8 @@ Value DbfStream::GetItemMemo(int i, bool binary) const
return Value(); return Value();
if(!binary) { if(!binary) {
byte *p; byte *p;
if(p = (byte *)memchr(buffer, '\0', len)) len = p - buffer; if(p = (byte *)memchr(buffer, '\0', len)) len = (unsigned)(p - buffer);
if(p = (byte *)memchr(buffer, '\x1A', len)) len = p - buffer; if(p = (byte *)memchr(buffer, '\x1A', len)) len = (unsigned)(p - buffer);
} }
out = String(buffer, len); out = String(buffer, len);
} }
@ -936,7 +936,7 @@ Value DbfStream::GetItemMemo(int i, bool binary) const
eof = true; eof = true;
break; break;
} }
int l = e - buffer; int l = (int)(e - buffer);
if(!eof && l > dbt_block_size) { if(!eof && l > dbt_block_size) {
dbt.SeekCur(dbt_block_size - l); dbt.SeekCur(dbt_block_size - l);
e = buffer + l; e = buffer + l;