diff --git a/uppsrc/Core/Mt.h b/uppsrc/Core/Mt.h index 563c382f3..e7f0b1ec8 100644 --- a/uppsrc/Core/Mt.h +++ b/uppsrc/Core/Mt.h @@ -56,14 +56,17 @@ public: int Wait(); bool IsOpen() const { return handle; } + #ifdef PLATFORM_WIN32 - HANDLE GetHandle() const { return handle; } + typedef HANDLE Handle; #endif #ifdef PLATFORM_POSIX - pthread_t GetHandle() const { return handle; } + typedef pthread_t Handle; #endif + Handle GetHandle() const { return handle; } + void Priority(int percent); // 0 = lowest, 100 = normal static void Start(Callback cb); @@ -76,6 +79,12 @@ public: static void ShutdownThreads(); static bool IsShutdownThreads(); +#ifdef PLATFORM_WIN32 + static Handle GetCurrentHandle() { return GetCurrentThread(); } +#endif +#ifdef PLATFORM_POSIX + static Handle GetCurrentHandle() { return pthread_self(); } +#endif Thread(); ~Thread(); diff --git a/uppsrc/Core/Value.h b/uppsrc/Core/Value.h index cc896aba6..db74a32e5 100644 --- a/uppsrc/Core/Value.h +++ b/uppsrc/Core/Value.h @@ -206,15 +206,15 @@ inline bool operator==(const wchar *x, const Value& v) { return (WString)v == x inline bool operator!=(const Value& v, const wchar *x) { return (WString)v != x; } inline bool operator!=(const wchar *x, const Value& v) { return (WString)v != x; } -inline bool IsVoidValueTypeNo(int q) { return q == VOID_V; } -inline bool IsErrorValueTypeNo(int q) { return q == ERROR_V; } -inline bool IsStringValueTypeNo(int q) { return q == STRING_V || q == WSTRING_V; } +inline bool IsVoidValueTypeNo(int q) { return (dword)q == VOID_V; } +inline bool IsErrorValueTypeNo(int q) { return (dword)q == ERROR_V; } +inline bool IsStringValueTypeNo(int q) { return (dword)q == STRING_V || (dword)q == WSTRING_V; } -inline bool IsIntegerValueTypeNo(int q) { return q == INT_V || q == INT64_V || q == BOOL_V; } -inline bool IsFloatValueTypeNo(int q) { return q == DOUBLE_V; } +inline bool IsIntegerValueTypeNo(int q) { return (dword)q == INT_V || (dword)q == INT64_V || (dword)q == BOOL_V; } +inline bool IsFloatValueTypeNo(int q) { return (dword)q == DOUBLE_V; } inline bool IsNumberValueTypeNo(int q) { return IsIntegerValueTypeNo(q) || IsFloatValueTypeNo(q); } -inline bool IsDateTimeValueTypeNo(int q) { return q == DATE_V || q == TIME_V; } +inline bool IsDateTimeValueTypeNo(int q) { return (dword)q == DATE_V || (dword)q == TIME_V; } inline bool IsVoid(const Value& v) { return v.GetType() == VOID_V; } inline bool IsError(const Value& v) { return v.GetType() == ERROR_V; } diff --git a/uppsrc/Core/XML.cpp b/uppsrc/Core/XML.cpp index b28a63a87..c7483e6b1 100644 --- a/uppsrc/Core/XML.cpp +++ b/uppsrc/Core/XML.cpp @@ -860,7 +860,6 @@ String AsXML(const XmlNode& node, dword style) XmlTag tag(node.GetText()); for(int i = 0; i < node.GetAttrCount(); i++) tag(node.AttrId(i), node.Attr(i)); - bool preserve = false; if(node.GetCount()) { StringBuffer body; for(int i = 0; i < node.GetCount(); i++) diff --git a/uppsrc/Core/heap.cpp b/uppsrc/Core/heap.cpp index 4d3701285..494596592 100644 --- a/uppsrc/Core/heap.cpp +++ b/uppsrc/Core/heap.cpp @@ -18,7 +18,6 @@ void Heap::Init() return; LLOG("Init heap " << (void *)this); for(int i = 0; i < NKLASS; i++) { - int sz = Ksz(i); empty[i] = NULL; full[i]->LinkSelf(); work[i]->LinkSelf(); diff --git a/uppsrc/Core/parser.cpp b/uppsrc/Core/parser.cpp index 74b343335..a3b703666 100644 --- a/uppsrc/Core/parser.cpp +++ b/uppsrc/Core/parser.cpp @@ -381,7 +381,7 @@ CParser::CParser(const char *ptr) } CParser::CParser(const char *ptr, const char *fn, int line) -: term(ptr), line(line), fn(fn), lineptr(ptr) +: term(ptr), lineptr(ptr), line(line), fn(fn) { skipspaces = true; Spaces(); diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index 4f8d9d08b..56ce4c514 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -1207,7 +1207,7 @@ CppItem& Parser::Fn(const Decl& d, const String& templ, bool body, int q; if(d.castoper) { q = d.name.ReverseFind(' '); - q = q > 0 ? d.name.ReverseFind(':', q) : q = d.name.ReverseFind(':'); + q = q > 0 ? d.name.ReverseFind(':', q) : d.name.ReverseFind(':'); } else q = d.name.ReverseFind(':'); diff --git a/uppsrc/CtrlCore/Win32Clip.cpp b/uppsrc/CtrlCore/Win32Clip.cpp index e298632dd..24f936df1 100644 --- a/uppsrc/CtrlCore/Win32Clip.cpp +++ b/uppsrc/CtrlCore/Win32Clip.cpp @@ -338,7 +338,7 @@ Image GetImage(PasteClip& clip) } if(clip.Accept("dib")) { String data = ~clip; - if(data.GetCount() < sizeof(BITMAPINFO)) return Null; + if((unsigned)data.GetCount() < sizeof(BITMAPINFO)) return Null; BITMAPINFO *lpBI = (BITMAPINFO *)~data; BITMAPINFOHEADER& hdr = lpBI->bmiHeader; byte *bits = (byte *)lpBI + hdr.biSize; @@ -437,7 +437,7 @@ Vector GetFiles(PasteClip& clip) GuiLock __; Vector f; String data = clip; - if(data.GetCount() < sizeof(sDROPFILES) + 2) + if((unsigned)data.GetCount() < sizeof(sDROPFILES) + 2) return f; const sDROPFILES *df = (const sDROPFILES *)~data; const char *s = ((const char *)df + df->offset); diff --git a/uppsrc/CtrlCore/Win32Wnd.cpp b/uppsrc/CtrlCore/Win32Wnd.cpp index ed26feea4..a9047cf3b 100644 --- a/uppsrc/CtrlCore/Win32Wnd.cpp +++ b/uppsrc/CtrlCore/Win32Wnd.cpp @@ -624,7 +624,7 @@ struct WinMsg { } sWinMsg[] = { #include "Win32Msg.i" - 0, NULL + {0, NULL} }; #endif diff --git a/uppsrc/CtrlLib/ChWin32.cpp b/uppsrc/CtrlLib/ChWin32.cpp index cf4b7e748..e6d6cacde 100644 --- a/uppsrc/CtrlLib/ChWin32.cpp +++ b/uppsrc/CtrlLib/ChWin32.cpp @@ -167,7 +167,6 @@ int XpInt(int widget, int part, int state, int type) if(!theme) return Null; int n = Null; - int x = 0; int r = XpTheme().GetThemeInt(theme, part, state, type, &n); return r == S_OK ? n : Null; } @@ -177,7 +176,6 @@ int XpBool(int widget, int part, int state, int type) HANDLE theme = XpWidget(widget); if(!theme) return Null; - int x = 0; BOOL flag = false; int r = XpTheme().GetThemeBool(theme, part, state, type, &flag); return r == S_OK ? flag : Null; diff --git a/uppsrc/CtrlLib/ColumnList.cpp b/uppsrc/CtrlLib/ColumnList.cpp index 57ce67677..b3135784f 100644 --- a/uppsrc/CtrlLib/ColumnList.cpp +++ b/uppsrc/CtrlLib/ColumnList.cpp @@ -437,7 +437,6 @@ void ColumnList::PaintRows(Draw &w, Size &sz) int pos = sb % cy; int y = -pos; int i = GetSbPos(sz); - int coli = 0; while(y < sz.cy-pos+cy) { int x = 0; while (x + cx <= sz.cx) { diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index bfe46eeb8..7f23b5dfb 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -79,7 +79,6 @@ int ExtractAccessKey(const char *s, String& label) byte akey = 0; int pos = 0; String text; - const char* start = s; bool qtf = *s == '\1'; while(*s) if((*s == '&' && !qtf || *s == '\b') && s[1] && s[1] != '&') { @@ -488,7 +487,6 @@ void DisplayPopup::Sync() Ctrl *top = ctrl->GetTopCtrl(); if(top && top->HasFocusDeep()) { Size sz = display->GetStdSize(value); - Ctrl *top = ctrl->GetTopWindow(); if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) { Rect wa = GetWorkArea(); slim = item + ctrl->GetScreenView().TopLeft(); diff --git a/uppsrc/CtrlLib/MenuItem.cpp b/uppsrc/CtrlLib/MenuItem.cpp index 615a636fa..5239568cf 100644 --- a/uppsrc/CtrlLib/MenuItem.cpp +++ b/uppsrc/CtrlLib/MenuItem.cpp @@ -111,7 +111,6 @@ void DrawMnemonicText(Draw& w, int x, int y, const String& s, Font font, Color c int mnemonic) { int apos = HIWORD(mnemonic); - int akey = LOWORD(mnemonic); int q; if(apos && apos < s.GetLength()) q = apos - 1; diff --git a/uppsrc/Draw/FontCR.cpp b/uppsrc/Draw/FontCR.cpp index 0b154cb43..c5652376b 100644 --- a/uppsrc/Draw/FontCR.cpp +++ b/uppsrc/Draw/FontCR.cpp @@ -228,30 +228,30 @@ struct sRFace { const char *name; dword l, h; } sFontReplacements[] = { - "sans-serif", 0xffee0008, 0xdc000801, - "Arial", 0xfffe0000, 0x09c00080, - "Arial Unicode MS", 0xfffc3fef, 0xfa7ff7e7, - "MS UI Gothic", 0xffc01008, 0x0fffff00, - "MS Mincho", 0xffc01008, 0x0fffff00, - "WenQuanYi Zen Hei Mono", 0xfd800000, 0x0ae7ff7e, - "WenQuanYi Zen Hei", 0xfd800000, 0x0ae7ff7e, - "VL Gothic", 0xfd800000, 0x09a7ff80, - "VL PGothic", 0xffe00008, 0x0de7ff80, - "UnDotum", 0xe5800000, 0x0aa7ff7e, - "UnBatang", 0xe5800000, 0x0aa7ff7e, - "DejaVu Sans Mono", 0xffec0004, 0x0fc00080, - "DejaVu Sans", 0xfffd000c, 0x0fc40080, - "AlArabiyaFreeSerif", 0xffdc0008, 0xd8000007, - "Kochi Mincho", 0xffdc0008, 0xd8000007, - "Kochi Gothic", 0xffdc0008, 0xd8000007, - "Sazanami Mincho", 0xffdc0008, 0xd8000007, - "Sazanami Gothic", 0xffdc0008, 0xd8000007, - "Gulim", 0xf7c00000, 0x0ba7ff7e, - "SimSun", 0xfd800000, 0x09ffff00, - "PMingLiU", 0xff800000, 0x09ffff00, - "FreeSans", 0xfff23d00, 0x0fc00000, - "FreeSerif", 0xfffd3938, 0x0fc00080, - "Symbol", 0xe4000000, 0x88000002, + { "sans-serif", 0xffee0008, 0xdc000801 }, + { "Arial", 0xfffe0000, 0x09c00080 }, + { "Arial Unicode MS", 0xfffc3fef, 0xfa7ff7e7 }, + { "MS UI Gothic", 0xffc01008, 0x0fffff00 }, + { "MS Mincho", 0xffc01008, 0x0fffff00 }, + { "WenQuanYi Zen Hei Mono", 0xfd800000, 0x0ae7ff7e }, + { "WenQuanYi Zen Hei", 0xfd800000, 0x0ae7ff7e }, + { "VL Gothic", 0xfd800000, 0x09a7ff80 }, + { "VL PGothic", 0xffe00008, 0x0de7ff80 }, + { "UnDotum", 0xe5800000, 0x0aa7ff7e }, + { "UnBatang", 0xe5800000, 0x0aa7ff7e }, + { "DejaVu Sans Mono", 0xffec0004, 0x0fc00080 }, + { "DejaVu Sans", 0xfffd000c, 0x0fc40080 }, + { "AlArabiyaFreeSerif", 0xffdc0008, 0xd8000007 }, + { "Kochi Mincho", 0xffdc0008, 0xd8000007 }, + { "Kochi Gothic", 0xffdc0008, 0xd8000007 }, + { "Sazanami Mincho", 0xffdc0008, 0xd8000007 }, + { "Sazanami Gothic", 0xffdc0008, 0xd8000007 }, + { "Gulim", 0xf7c00000, 0x0ba7ff7e }, + { "SimSun", 0xfd800000, 0x09ffff00 }, + { "PMingLiU", 0xff800000, 0x09ffff00 }, + { "FreeSans", 0xfff23d00, 0x0fc00000 }, + { "FreeSerif", 0xfffd3938, 0x0fc00080 }, + { "Symbol", 0xe4000000, 0x88000002 }, }; struct sFontMetricsReplacement { diff --git a/uppsrc/HexView/HexView.cpp b/uppsrc/HexView/HexView.cpp index 9d7182cf8..71dfb1c1d 100644 --- a/uppsrc/HexView/HexView.cpp +++ b/uppsrc/HexView/HexView.cpp @@ -104,12 +104,12 @@ void HexViewInfo::Paint(Draw& w) i = 0; for(;;) { if(data[i] < 0) { - if(i < sizeof(float)) + if((unsigned)i < sizeof(float)) ftxt = "?"; txt = "?"; break; } - if(i >= sizeof(double)) { + if((unsigned)i >= sizeof(double)) { double h; memcpy(&h, sh, sizeof(double)); txt = Sprintf("%.8g", h); @@ -310,7 +310,6 @@ bool HexView::Key(dword key, int) { int pg = max(columns, bytes - columns); int q = int(sc % columns); - int64 c = cursor & ~1023; switch(key) { case K_LEFT: SetCursor(cursor - 1); diff --git a/uppsrc/Painter/Image.cpp b/uppsrc/Painter/Image.cpp index ae65a12fa..7c6027a22 100644 --- a/uppsrc/Painter/Image.cpp +++ b/uppsrc/Painter/Image.cpp @@ -75,7 +75,6 @@ struct PainterImageSpan : SpanSource { Image image; void Set(const Xform2D& m, const Image& img) { - int level = 0; image = img; int nx = 1; int ny = 1; diff --git a/uppsrc/Painter/RadialGradient.cpp b/uppsrc/Painter/RadialGradient.cpp index 34ba32a67..1a180709e 100644 --- a/uppsrc/Painter/RadialGradient.cpp +++ b/uppsrc/Painter/RadialGradient.cpp @@ -19,8 +19,6 @@ struct PainterRadialSpan : SpanSource { fy = _fy; fx -= cx; fy -= cy; - double fx2 = double(fx) * double(fx); - double fy2 = double(fy) * double(fy); C = fx * fx + fy * fy - r * r; } diff --git a/uppsrc/Painter/Rasterizer.cpp b/uppsrc/Painter/Rasterizer.cpp index 3ceb4a5a2..6ab296e45 100644 --- a/uppsrc/Painter/Rasterizer.cpp +++ b/uppsrc/Painter/Rasterizer.cpp @@ -186,7 +186,6 @@ void Rasterizer::LineRaw(int x1, int y1, int x2, int y2) LLOG("Rasterizer::LineRaw " << x1 / 256.0 << ':' << y1 / 256.0 << " - " << x2 / 256.0 << ':' << y2 / 256.0); int ex1 = x1 >> 8; - int ex2 = x2 >> 8; int ey1 = y1 >> 8; int ey2 = y2 >> 8; @@ -233,8 +232,7 @@ void Rasterizer::LineRaw(int x1, int y1, int x2, int y2) } incr = 1; if(dx == 0) { - int ex = x1 >> 8; - int two_fx = (x1 - (ex << 8)) << 1; + int two_fx = (x1 - (ex1 << 8)) << 1; int area; first = 256; if(dy < 0) { diff --git a/uppsrc/PdfDraw/PdfDraw.cpp b/uppsrc/PdfDraw/PdfDraw.cpp index 80c75b2c3..6b50ad685 100644 --- a/uppsrc/PdfDraw/PdfDraw.cpp +++ b/uppsrc/PdfDraw/PdfDraw.cpp @@ -898,7 +898,7 @@ String PdfDraw::Finish() if(hfont) { HDC hdc = Win32_IC(); HFONT ohfont = (HFONT) ::SelectObject(hdc, hfont); - int size = GetFontData(hdc, 0, 0, NULL, 0); + DWORD size = GetFontData(hdc, 0, 0, NULL, 0); if(size == GDI_ERROR) { LLOG("PdfDraw::Finish: GDI_ERROR on font " << pdffont.GetKey(i)); return Null; diff --git a/uppsrc/RichText/TxtPaint.cpp b/uppsrc/RichText/TxtPaint.cpp index 41edbebbe..fd377a76c 100644 --- a/uppsrc/RichText/TxtPaint.cpp +++ b/uppsrc/RichText/TxtPaint.cpp @@ -41,7 +41,6 @@ void RichTxt::Sync0(const Para& pp, int parti, const RichContext& rc) const } void RichTxt::Sync(int parti, const RichContext& rc) const { - int cx = rc.page.Width(); ASSERT(part[parti].Is()); const Para& pp = part[parti].Get(); if(rc.page.Width() != pp.ccx) diff --git a/uppsrc/coff/lib.cpp b/uppsrc/coff/lib.cpp index 2c5e57969..fb5e9d9c8 100644 --- a/uppsrc/coff/lib.cpp +++ b/uppsrc/coff/lib.cpp @@ -34,7 +34,7 @@ static double ToLibraryTime(Time time) } ArchiveJob::Object::Object(ArchiveJob& archive, int index, String fn, String od, double ft, int ho, bool nf) -: archive(archive), index(index), filename(fn), object_data(od), filetime(ft), header_offset(ho), newfile(nf) +: archive(archive), index(index), filename(fn), object_data(od), filetime(ft), newfile(nf), header_offset(ho) { trimmed_name = archive.TrimObjectName(filename); longname_offset = -1; @@ -107,7 +107,6 @@ void ArchiveJob::LoadLibrary(String libfile) if(verbose) PutStdOut(NFormat("%s: reading archive (%d B)", libfile, mapping.GetFileSize())); - int objcount = -1; const byte *ptr = mapping.GetIter(8); const byte *end = mapping.End(); const byte *longptr = NULL; diff --git a/uppsrc/ide/Browser/CodeRef.cpp b/uppsrc/ide/Browser/CodeRef.cpp index dd8a58796..56a6a1490 100644 --- a/uppsrc/ide/Browser/CodeRef.cpp +++ b/uppsrc/ide/Browser/CodeRef.cpp @@ -271,7 +271,6 @@ String CreateQtf(const String& item, const String& name, const CppItem& m, bool d.Clear(); d = "[%% "; Vector p = Split(m.pname, ';'); - bool was = false; if(!str) for(int i = 0; i < p.GetCount(); i++) d << " [%-*@r " << DeQtf(p[i]) << "]"; diff --git a/uppsrc/ide/FindInFiles.cpp b/uppsrc/ide/FindInFiles.cpp index 76d9b3693..910b9422d 100644 --- a/uppsrc/ide/FindInFiles.cpp +++ b/uppsrc/ide/FindInFiles.cpp @@ -219,11 +219,9 @@ void Ide::FindFileName() { ffdlg.mask.NullText("Search"); ffdlg.mask.SetFilter(CharFilterFindFileMask); ffdlg.mask <<= ffdlg.Breaker(IDYES); - int prev = 0; for(;;) { ffdlg.list.Clear(); String mask = ~ffdlg.mask; - const char *best_err = NULL; for(int p = 0; p < wspc.GetCount(); p++) { String packname = wspc[p]; const Package& pack = wspc.GetPackage(p); diff --git a/uppsrc/ide/Print.cpp b/uppsrc/ide/Print.cpp index 25d9aab9a..ca86daee5 100644 --- a/uppsrc/ide/Print.cpp +++ b/uppsrc/ide/Print.cpp @@ -112,7 +112,6 @@ void Ide::Print() job.Landscape(dlg.orientation); if(!job.Execute()) return; - Draw& w = job; int l, h; if(editor.GetSelection(l, h)) { l = editor.GetLine(l); diff --git a/uppsrc/ide/UppWspc.cpp b/uppsrc/ide/UppWspc.cpp index 51b3faeb7..7d3d56809 100644 --- a/uppsrc/ide/UppWspc.cpp +++ b/uppsrc/ide/UppWspc.cpp @@ -310,6 +310,7 @@ void WorkspaceWork::AddFile(ADDFILE af) case HOME_FILE: fs->ActiveDir(GetHomeDirectory()); break; #endif case LOCAL_FILE: fs->ActiveDir(GetLocalDir()); break; + default: ; // GCC warns otherwise } if(!fs->ExecuteOpen("Add files to package..")) return; int fci = filelist.GetCursor(); @@ -426,7 +427,6 @@ void WorkspaceWork::Import() Progress pi("Importing file %d"); int fci = filelist.GetCursor(); int cs = filelist.GetSbPos(); - int ci = fci >= 0 && fci < fileindex.GetCount() ? fileindex[fci] : -1; try { DoImport(~dlg.folder, ~dlg.files, false, pi); } diff --git a/uppsrc/ide/ide.cpp b/uppsrc/ide/ide.cpp index 08a59e75e..c5f569ee9 100644 --- a/uppsrc/ide/ide.cpp +++ b/uppsrc/ide/ide.cpp @@ -319,7 +319,6 @@ bool Ide::FindLineError(int l, Host& host) { String file; int lineno; int error; - int q = btabs.GetCursor(); Console& c = GetConsole(); if (FindLineError(c.GetUtf8Line(l), host, file, lineno, error)) { file = NormalizePath(file); diff --git a/uppsrc/usvn/SvnFs.cpp b/uppsrc/usvn/SvnFs.cpp index b75857322..cf9cfd03d 100644 --- a/uppsrc/usvn/SvnFs.cpp +++ b/uppsrc/usvn/SvnFs.cpp @@ -35,7 +35,6 @@ bool SvnSel::Load(const String& path) for(int i = 0; i < l.GetCount(); i++) { String fn = l[i]; if(fn.GetLength()) { - bool isdir = false; if(*fn.Last() == '/' || *fn.Last() == '\\') { fn.Trim(fn.GetLength() - 1); if(pass == 0)