diff --git a/uppsrc/Core/HeapImp.h b/uppsrc/Core/HeapImp.h index f4f5ae867..15564be1b 100644 --- a/uppsrc/Core/HeapImp.h +++ b/uppsrc/Core/HeapImp.h @@ -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); diff --git a/uppsrc/Core/heaputil.cpp b/uppsrc/Core/heaputil.cpp index 974f77f04..bf5147631 100644 --- a/uppsrc/Core/heaputil.cpp +++ b/uppsrc/Core/heaputil.cpp @@ -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; } diff --git a/uppsrc/Core/lheap.cpp b/uppsrc/Core/lheap.cpp index 77ffe0c61..cdc188d4b 100644 --- a/uppsrc/Core/lheap.cpp +++ b/uppsrc/Core/lheap.cpp @@ -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); diff --git a/uppsrc/Draw/Image.cpp b/uppsrc/Draw/Image.cpp index 829a60428..f8f686ea9 100644 --- a/uppsrc/Draw/Image.cpp +++ b/uppsrc/Draw/Image.cpp @@ -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 { diff --git a/uppsrc/GridCtrl/GridDisplay.cpp b/uppsrc/GridCtrl/GridDisplay.cpp index c1f002057..b28866d3c 100644 --- a/uppsrc/GridCtrl/GridDisplay.cpp +++ b/uppsrc/GridCtrl/GridDisplay.cpp @@ -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);