diff --git a/uppsrc/CtrlLib/CtrlLib.usc b/uppsrc/CtrlLib/CtrlLib.usc index b815ad547..df1500e79 100644 --- a/uppsrc/CtrlLib/CtrlLib.usc +++ b/uppsrc/CtrlLib/CtrlLib.usc @@ -193,11 +193,6 @@ subctrl NormalSize { subctrl Base { >NormalSize; - Font SetFont = StdFont(); - Color SetInk = :SBlack; - Frame SetFrame @1; -// Qtf SetInfo @1 ? "Info of control" ; - ViewRect(w) { r = GetRect(); DrawCtrlFrame(w, r, .SetFrame); @@ -210,7 +205,17 @@ subctrl Base { }; subctrl Unknown { - > Base; + >NormalSize; + + ViewRect(w) { + r = GetRect(); + DrawCtrlFrame(w, r, .SetFrame); + return r; + } + ViewSize(w) { + r = ViewRect(w); + return Size(r.right - r.left, r.bottom - r.top); + } }; subctrl TextCtrl { diff --git a/uppsrc/Draw/Image.cpp b/uppsrc/Draw/Image.cpp index 1698c9e8d..de372d187 100644 --- a/uppsrc/Draw/Image.cpp +++ b/uppsrc/Draw/Image.cpp @@ -353,7 +353,7 @@ uint64 Image::GetAuxData() const return data ? data->aux_data : 0; } -static void sMultiply(ImageBuffer& b, int (*op)(RGBA *t, const RGBA *s, int len)) +static void sMultiply(ImageBuffer& b, int (*op)(RGBA *t, const RGBA *s, size_t len)) { if(b.GetKind() != IMAGE_OPAQUE && b.GetKind() != IMAGE_EMPTY) (*op)(~b, ~b, b.GetLength()); @@ -369,7 +369,7 @@ void Unmultiply(ImageBuffer& b) sMultiply(b, Unmultiply); } -static Image sMultiply(const Image& img, int (*op)(RGBA *t, const RGBA *s, int len)) +static Image sMultiply(const Image& img, int (*op)(RGBA *t, const RGBA *s, size_t len)) { int k = img.GetKind(); if(k == IMAGE_OPAQUE || k == IMAGE_EMPTY) diff --git a/uppsrc/Draw/Image.h b/uppsrc/Draw/Image.h index 5e4c62666..b8fd9072b 100644 --- a/uppsrc/Draw/Image.h +++ b/uppsrc/Draw/Image.h @@ -8,11 +8,11 @@ enum ImageKind { IMAGE_OPAQUE, }; -inline void Fill(RGBA *t, RGBA c, int n) { memset32(t, *(dword *)&c, n); } +inline void Fill(RGBA *t, RGBA c, size_t n) { memset32(t, *(dword *)&c, n); } inline void Copy(RGBA *t, const RGBA *s, int n) { memcpy_t(t, s, n); } -int Premultiply(RGBA *t, const RGBA *s, int len); -int Unmultiply(RGBA *t, const RGBA *s, int len); +int Premultiply(RGBA *t, const RGBA *s, size_t len); +int Unmultiply(RGBA *t, const RGBA *s, size_t len); void TransformComponents(RGBA *t, const RGBA *s, int len, const byte r[], const byte g[], const byte b[], const byte a[]); @@ -167,26 +167,26 @@ private: void SetAuxData(uint64 data); public: - Size GetSize() const { return data ? data->buffer.GetSize() : Size(0, 0); } - int GetWidth() const { return GetSize().cx; } - int GetHeight() const { return GetSize().cy; } - int GetLength() const { return data ? data->buffer.GetLength() : 0; } - Point GetHotSpot() const; - Point Get2ndSpot() const; - Size GetDots() const; - Size GetDPI() const; - int GetKindNoScan() const; - int GetKind() const; - int GetResolution() const; - bool IsOpaque() const { return GetKind() == IMAGE_OPAQUE; } + Size GetSize() const { return data ? data->buffer.GetSize() : Size(0, 0); } + int GetWidth() const { return GetSize().cx; } + int GetHeight() const { return GetSize().cy; } + size_t GetLength() const { return data ? data->buffer.GetLength() : 0; } + Point GetHotSpot() const; + Point Get2ndSpot() const; + Size GetDots() const; + Size GetDPI() const; + int GetKindNoScan() const; + int GetKind() const; + int GetResolution() const; + bool IsOpaque() const { return GetKind() == IMAGE_OPAQUE; } - const RGBA *Begin() const { return data ? ~data->buffer : NULL; } - const RGBA *begin() const { return Begin(); } - const RGBA *End() const { return Begin() + GetLength(); } - const RGBA *end() const { return End(); } - const RGBA* operator~() const { return Begin(); } - operator const RGBA*() const { return Begin(); } - const RGBA* operator[](int i) const { ASSERT(data); return data->buffer[i]; } + const RGBA *Begin() const { return data ? ~data->buffer : NULL; } + const RGBA *begin() const { return Begin(); } + const RGBA *End() const { return Begin() + GetLength(); } + const RGBA *end() const { return End(); } + const RGBA* operator~() const { return Begin(); } + operator const RGBA*() const { return Begin(); } + const RGBA* operator[](int i) const { ASSERT(data); return data->buffer[i]; } int64 GetSerialId() const { return data ? data->serial : 0; } bool IsSame(const Image& img) const { return GetSerialId() == img.GetSerialId(); } diff --git a/uppsrc/Draw/ImageBlit.cpp b/uppsrc/Draw/ImageBlit.cpp index aa03efbed..af387b6e8 100644 --- a/uppsrc/Draw/ImageBlit.cpp +++ b/uppsrc/Draw/ImageBlit.cpp @@ -82,7 +82,7 @@ String PackRLE(const RGBA *s, int len) return String(r); } -int Premultiply(RGBA *t, const RGBA *s, int len) +int Premultiply(RGBA *t, const RGBA *s, size_t len) { const RGBA *e = s + len; while(s < e) { @@ -125,7 +125,7 @@ void sInitUmTable__() } } -int Unmultiply(RGBA *t, const RGBA *s, int len) +int Unmultiply(RGBA *t, const RGBA *s, size_t len) { sInitUmTable__(); const RGBA *e = s + len; diff --git a/uppsrc/Draw/ImageOp.cpp b/uppsrc/Draw/ImageOp.cpp index fe80d82bd..e6c304825 100644 --- a/uppsrc/Draw/ImageOp.cpp +++ b/uppsrc/Draw/ImageOp.cpp @@ -347,7 +347,7 @@ Image Equalight(const Image& img, int thold) histogram[Grayscale(*s)]++; s++; } - int n = (thold * img.GetLength()) >> 8; + size_t n = (thold * img.GetLength()) >> 8; int h = 255; int l = 0; while(l < h) { diff --git a/uppsrc/Draw/Iml.cpp b/uppsrc/Draw/Iml.cpp index f6342571c..c7de20dac 100644 --- a/uppsrc/Draw/Iml.cpp +++ b/uppsrc/Draw/Iml.cpp @@ -17,7 +17,7 @@ Vector UnpackImlData(const void *ptr, int len) ib.SetHotSpot(Point(Peek16le(s + 5), Peek16le(s + 7))); ib.Set2ndSpot(Point(Peek16le(s + 9), Peek16le(s + 11))); s += 13; - int len = ib.GetLength(); + size_t len = ib.GetLength(); RGBA *t = ib; const RGBA *e = t + len; if(s + 4 * len > data.End()) diff --git a/uppsrc/Draw/MakeCache.cpp b/uppsrc/Draw/MakeCache.cpp index 0d4f437f9..906e03348 100644 --- a/uppsrc/Draw/MakeCache.cpp +++ b/uppsrc/Draw/MakeCache.cpp @@ -21,7 +21,7 @@ struct scImageMaker : ValueMaker { if(paintonly && !IsNull(img) && img.GetRefCount() == 1) SetPaintOnly__(img); object = img; - return img.GetLength() + 64; + return (int)min((size_t) INT_MAX, img.GetLength()) + 64; } }; @@ -36,7 +36,7 @@ void SysImageRealized(const Image& img) ValueCacheAdjustSize([](const Value& v) -> int { if(v.Is()) { const Image& img = v.To(); - return 64 + (~img ? img.GetLength() : 0); + return 64 + (~img ? (int)min((size_t) INT_MAX, img.GetLength()) : 0); } return -1; }); diff --git a/uppsrc/umk/umake.cpp b/uppsrc/umk/umake.cpp index cdfeb8fec..43d839b7d 100644 --- a/uppsrc/umk/umake.cpp +++ b/uppsrc/umk/umake.cpp @@ -272,7 +272,7 @@ CONSOLE_APP_MAIN for(const String& s : runargs) Add(s); args.Add(NULL); - SetExitCode(execv(ide.target, args.begin())); + SetExitCode((int)execv(ide.target, args.begin())); } } else