uppsrc: Fixed more Win64 warnings

git-svn-id: svn://ultimatepp.org/upp/trunk@5822 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-02-18 09:57:51 +00:00
parent c459246cfd
commit 9e1b30113a
5 changed files with 14 additions and 13 deletions

View file

@ -1,6 +1,6 @@
void OutOfMemoryPanic(size_t size);
void *SysAllocRaw(size_t size, int reqsize);
void *SysAllocRaw(size_t size, size_t reqsize);
void SysFreeRaw(void *ptr, size_t size);
void *AllocRaw4KB(int reqsize);

View file

@ -18,8 +18,9 @@ void *MemoryAllocPermanentRaw(size_t size)
return malloc(size);
static byte *ptr = NULL;
static byte *limit = NULL;
ASSERT(size < INT_MAX);
if(ptr + size >= limit) {
ptr = (byte *)AllocRaw4KB(size);
ptr = (byte *)AllocRaw4KB((int)size);
limit = ptr + 4096;
}
void *p = ptr;
@ -60,7 +61,7 @@ int sKB;
int MemoryUsedKb() { return sKB; }
void *SysAllocRaw(size_t size, int reqsize)
void *SysAllocRaw(size_t size, size_t reqsize)
{
sKB += int(((size + 4095) & ~4095) >> 10);
#ifdef PLATFORM_WIN32
@ -75,7 +76,7 @@ void *SysAllocRaw(size_t size, int reqsize)
ptr = NULL;
#endif
if(!ptr)
OutOfMemoryPanic((size_t)reqsize);
OutOfMemoryPanic(reqsize);
DoPeakProfile();
return ptr;
}

View file

@ -186,7 +186,7 @@ void *Heap::LAlloc(size_t& size) {
ptr = TryLAlloc(bini, size);
if(ptr) return ptr;
}
DLink *n = AddChunk(size);
DLink *n = AddChunk((int)size);
if(!n)
Panic("Out of memory!");
ptr = DivideBlock(n, (int)size, LBINS - 1);

View file

@ -250,7 +250,7 @@ void Image::Serialize(Stream& s)
len -= INT_MAX;
offset += INT_MAX;
}
if(!s.GetAll((void*)(ptr+offset), len))
if(!s.GetAll((void*)(ptr+offset), (int)len))
s.SetError();
b.SetDots(dots);
@ -270,7 +270,7 @@ void Image::Serialize(Stream& s)
len -= INT_MAX;
offset += INT_MAX;
}
s.Put(ptr+offset, len);
s.Put(ptr+offset, (int)len);
}
}
INITBLOCK {

View file

@ -292,7 +292,7 @@ int GridDisplay::GetLinesCount(int cx, const wchar* s, const Font& font, bool wr
{
if(p - e > 0 && wrap)
{
int tcx = GetTextSize(e, font, p - e).cx;
int tcx = GetTextSize(e, font, int(p - e)).cx;
if(tcx > cx)
{
lines += tcx / ccx;
@ -365,7 +365,7 @@ void GridDisplay::DrawText(Draw &w, int mx, int x, int y, int cx, int cy, int al
}*/
int tx = x;
tsz = GetTextSize(t, font, p - t);
tsz = GetTextSize(t, font, int(p - t));
if(tsz.cx > gcx)
{
@ -398,8 +398,8 @@ void GridDisplay::DrawText(Draw &w, int mx, int x, int y, int cx, int cy, int al
if(found)
{
int chs = t - s;
int che = p - s - 1;
int chs = int(t - s);
int che = int(p - s - 1);
if(fs <= che && fe >= chs)
{
@ -422,12 +422,12 @@ void GridDisplay::DrawText(Draw &w, int mx, int x, int y, int cx, int cy, int al
if(p > t)
{
w.Clip(x, y, cx - isz.cx , cy);
w.DrawText(max(mx, tx), ty, t, font, tfg, p - t);
w.DrawText(max(mx, tx), ty, t, font, tfg, int(p - t));
w.End();
}
}
else
w.DrawText(max(mx, tx), ty, t, font, tfg, p - t);
w.DrawText(max(mx, tx), ty, t, font, tfg, int(p - t));
ty += tcy;
t = textbreak ? p : (p = pp + 1);