uppsrc: Fixed various MSBT warnings

This commit is contained in:
Mirek Fidler 2022-12-11 09:36:58 +01:00
parent a4ec1ecd91
commit febbbf7f8b
17 changed files with 21 additions and 28 deletions

View file

@ -2,16 +2,12 @@ description "This package serves to gather all sources for language localisation
uses
CtrlLib,
Web,
ide,
PostgreSQL,
RichEdit,
MySql,
Ole,
GridCtrl,
Web,
Oracle,
usvn,
SqlCtrl,
plugin/astyle,
plugin/bmp,
@ -34,7 +30,6 @@ uses
plugin/ppm,
plugin/sqlite3,
plugin/tif,
plugin/wincert,
plugin/z,
plugin/zip,
Core/POP3,

View file

@ -43,7 +43,7 @@ class Thread : NoCopy {
pthread_t handle;
#endif
size_t stack_size = 0;
int stack_size = 0;
public:
bool Run(Function<void ()> cb, bool noshutdown = false);

View file

@ -120,7 +120,7 @@ public:
void SetNull(int ii) { SetData(ii, NULL, 0); }
void SetString(int ii, const char *s) { SetData(ii, s, strlen(s)); }
void SetString(int ii, const char *s) { SetData(ii, s, (int)strlen(s)); }
void SetString(int ii, const String& s) { SetData(ii, s, s.GetCount()); }
String GetString(int ii) const { String r; GetData(ii, [&](const char *s, int n) { r = String(s, n); }); return r; }
@ -140,7 +140,7 @@ public:
Vector<String> Unpack() const;
size_t GetPackedSize() const;
String GetPacked() const { return String((const char *)ptr, GetPackedSize()); }
String GetPacked() const { return String((const char *)ptr, (int)GetPackedSize()); }
PackedData() {}
PackedData(const PackedData&) = delete;

View file

@ -234,7 +234,7 @@ int Stream::GetUtf8()
return code;
if(code >= 0xC2) {
int c = 0, pos = GetPos();
int c = 0;
if(code < 0xE0) {
int c0 = Get();
if(c0 >= 0x80 && c0 < 0xC0 &&

View file

@ -134,7 +134,7 @@ Font Ctrl::GetFontAttr(int ii) const
{
if(layout_id_literal)
return Null;
static dword nullval = Font(Null).AsInt64();
static int64 nullval = Font(Null).AsInt64();
return Font::FromInt64(attrs.GetInt64(ii, nullval));
}
@ -155,7 +155,7 @@ void Ctrl::SetInt64Attr(int ii, int64 val)
Attrs().SetInt64(ii, val);
}
int Ctrl::GetInt64Attr(int ii, int64 def) const
int64 Ctrl::GetInt64Attr(int ii, int64 def) const
{
if(layout_id_literal)
return def;

View file

@ -844,7 +844,7 @@ protected:
int GetIntAttr(int ii, int def = Null) const;
void SetInt64Attr(int ii, int64 val);
int GetInt64Attr(int ii, int64 def = Null) const;
int64 GetInt64Attr(int ii, int64 def = Null) const;
void SetVoidPtrAttr(int ii, const void *ptr);
void *GetVoidPtrAttr(int ii) const;

View file

@ -279,7 +279,6 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
Rect orect = rect.Inflated(overpaint);
if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect))
return;
Ctrl *q;
Rect view = rect;
int n = GetFrameCount();
for(int i = 0; i < n; i++) {

View file

@ -230,7 +230,7 @@ void ImageSysData::CreateHBMP(HDC dc, const RGBA *data)
RGBA *pixels;
HBITMAP hbmp32 = CreateDIBSection(dcMem, bi, DIB_RGB_COLORS, (void **)&pixels, NULL, 0);
HDC hbmpOld = (HDC) ::SelectObject(dcMem, hbmp32);
Copy(pixels, data, img.GetLength());
Copy(pixels, data, (int)img.GetLength());
HDC dcMem2 = ::CreateCompatibleDC(dc);
hbmp = ::CreateCompatibleBitmap(dc, sz.cx, sz.cy);
HBITMAP o2 = (HBITMAP)::SelectObject(dcMem2, hbmp);
@ -260,7 +260,7 @@ void ImageSysData::Paint(SystemDraw& w, int x, int y, const Rect& src, Color c)
BitmapInfo32__ bi(sz.cx, sz.cy);
himg = CreateDIBSection(ScreenHDC(), bi, DIB_RGB_COLORS, (void **)&section, NULL, 0);
if(!himg) return; // Return on release.
Copy(section, ~img, img.GetLength());
Copy(section, ~img, (int)img.GetLength());
}
LTIMING("Image Alpha blit");
BLENDFUNCTION bf;
@ -294,7 +294,7 @@ struct ImageSysDataMaker : LRUCache<ImageSysData, int64>::Maker {
Image img;
virtual int64 Key() const { return img.GetSerialId(); }
virtual int Make(ImageSysData& object) const { object.Init(img); return img.GetLength(); }
virtual int Make(ImageSysData& object) const { object.Init(img); return (int)img.GetLength(); }
};
void SystemDraw::SysDrawImageOp(int x, int y, const Image& img, const Rect& src, Color color)
@ -320,7 +320,7 @@ void SystemDraw::SysDrawImageOp(int x, int y, const Image& img, const Rect& src,
ImageSysDataMaker m;
static LRUCache<ImageSysData, int64> cache;
static int Rsz;
Rsz += img.GetLength();
Rsz += (int)img.GetLength();
if(Rsz > 200 * 200) { // we do not want to do this for each small image painted...
Rsz = 0;
cache.Remove([](const ImageSysData& object) { return object.img.GetRefCount() == 1; });

View file

@ -409,7 +409,7 @@ String sDib(const Value& image)
header.biBitCount = 32;
header.biPlanes = 1;
header.biCompression = BI_RGB;
StringBuffer b(sizeof(header) + 4 * img.GetLength());
StringBuffer b(int(sizeof(header) + 4 * img.GetLength()));
byte *p = (byte *)~b;
memcpy(p, &header, sizeof(header));
memcpy(p + sizeof(header), ~img, 4 * img.GetLength());

View file

@ -80,7 +80,7 @@ protected:
void Reset();
friend class Popup;
friend struct Popup;
public:
Event<> WhenCancel;

View file

@ -368,7 +368,7 @@ String SaveIml(const Array<ImlImage>& iml, int format, const String& eol) {
SetResolution(m.image, IMAGE_RESOLUTION_UHD);
if(c.flags & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE))
SetResolution(m.image, IMAGE_RESOLUTION_NONE);
bl += c.image.GetLength();
bl += (int)c.image.GetLength();
bn++;
}
String bs = PackImlData(bimg);

View file

@ -83,7 +83,7 @@ void IconDes::Paint(Draw& w)
while(b < pb[y] + isz.cx)
*b++ = cc1;
}
AlphaBlend(pb, image, image.GetLength());
AlphaBlend(pb, image, (int)image.GetLength());
if(!pastepaint)
for(int y = 0; y < isz.cy; y++) {
const RGBA *m = selection[y];

View file

@ -623,7 +623,6 @@ bool AssistEditor::AssistTip(CodeEditor::MouseTip& mt)
void AssistEditor::SyncCurrentFile()
{
if(is_source_file) {
int line_delta;
CurrentFileContext cfx = CurrentContext();
SyncCurrentFile(cfx);
}

View file

@ -98,7 +98,7 @@ void Hdepend::ScanFile(const String& path, int map_index)
const char *term = src;
auto Id = [&](const char *id) {
int n = strlen(id);
int n = (int)strlen(id);
if(memcmp(term, id, n) == 0 && findarg(term[n], ' ', '\t') >= 0) {
term += n + 1;
return true;

View file

@ -43,7 +43,7 @@ void ReadAutocomplete(const CXCompletionString& string, String& name, String& si
const CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(string, j);
String text = FetchString(clang_getCompletionChunkText(string, j));
if(chunkKind == CXCompletionChunk_Optional)
for(int i = 0; i < clang_getNumCompletionChunks(string); i++)
for(unsigned i = 0; i < clang_getNumCompletionChunks(string); i++)
ReadAutocomplete(clang_getCompletionChunkCompletionString(string, i), name, signature);
else
if(chunkKind == CXCompletionChunk_TypedText) {
@ -185,7 +185,7 @@ void CurrentFileThread()
// DumpDiagnostics(cfc.clang.tu);
if(results) {
int tm = msecs();
for(int i = 0; i < results->NumResults; i++) {
for(unsigned i = 0; i < results->NumResults; i++) {
const CXCompletionString& string = results->Results[i].CompletionString;
int kind = results->Results[i].CursorKind;
// if(kind == CXCursor_MacroDefinition) // we probably want this only on Ctrl+Space

View file

@ -185,7 +185,7 @@ String CleanupPretty(const String& signature)
const char *b = s;
while(iscid(*s))
s++;
int len = s - b;
int len = int(s - b);
if(len == 5 && (memcmp(b, "class", 5) == 0 || memcmp(b, "union", 5) == 0) ||
len == 6 && (memcmp(b, "struct", 6) == 0 || memcmp(b, "extern", 6) == 0 || memcmp(b, "inline", 6) == 0) ||
len == 7 && (memcmp(b, "virtual", 7) == 0) ||

View file

@ -182,9 +182,9 @@ void Diagnostics(CXTranslationUnit tu, Event<const String&, Point, const String&
if(!HasLibClang())
return;
size_t num_diagnostics = clang_getNumDiagnostics(tu);
unsigned num_diagnostics = clang_getNumDiagnostics(tu);
for (size_t i = 0; i < num_diagnostics; ++i) {
for (unsigned i = 0; i < num_diagnostics; ++i) {
CXDiagnostic diagnostic = clang_getDiagnostic(tu, i);
auto Dump = [&](CXDiagnostic diagnostic, bool detail) {
CXFile file;