uppsrc: MacOS fixes

This commit is contained in:
Mirek Fidler 2023-03-21 11:10:03 +01:00
parent ca6d5122c2
commit b2456a14bb
13 changed files with 11 additions and 28 deletions

View file

@ -231,7 +231,9 @@
enum
{
INVALID_SOCKET = -1,
#ifndef TCP_NODELAY // macos defines it as macro, with the same value 1
TCP_NODELAY = 1,
#endif
SD_RECEIVE = 0,
SD_SEND = 1,
SD_BOTH = 2,

View file

@ -85,9 +85,9 @@ void sF128::MulPow10(int powi)
LTIMING("MulPow10");
ASSERT(l == 0); // we can only do F64xF128 multiplication
const auto& pow10 = ipow10table[powi + 350];
uint64 hh, midh, midl;
uint64 hh, midh;
l = mul64(h, pow10.h, hh);
midl = mul64(h, pow10.l, midh);
mul64(h, pow10.l, midh);
h = hh + addc64(l, midh, 0);
exponent += pow10.exponent;
if((h & ((uint64)1 << 63)) == 0) { // renormalize

View file

@ -20,18 +20,13 @@ FileSelNative& FileSelNative::AllFilesType()
}
bool FileSelNative::Execute0(int open, const char *title)
{
{
path.Clear();
Ctrl::ReleaseCtrlCapture();
if(!title)
title = open ? t_("Open") : t_("Save as");
CFRef<CFStringRef> mmtitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
NSWindow *window = nil;
Ctrl *win = Ctrl::GetActiveWindow();
if(win)
window = (NSWindow *)win->GetNSWindow();
if(open) {
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection: multi ? YES : NO];

View file

@ -240,7 +240,6 @@ RichCaret RichTable::GetCaret(int pos, RichContext rc) const
ASSERT(pos >= 0);
int nx = format.column.GetCount();
int ny = cell.GetCount();
int ti = 0;
const TabLayout& tab = Realize(rc);
for(int i = 0; i < ny; i++) {
const PaintRow& pr = tab[i];
@ -252,7 +251,6 @@ RichCaret RichTable::GetCaret(int pos, RichContext rc) const
int l = cl.text.GetLength() + 1;
if(pos < l)
return cl.GetCaret(pos, pr[j].MakeRichContext(MakeRichContext(rc, pr.py)), pyy);
ti += cl.text.GetTableCount();
pos -= l;
}
}

View file

@ -162,7 +162,6 @@ void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const
{
PaintInfo pi = _pi;
int parti = 0;
int pos = 0;
RichPara::Number n;
while(rc.py < pi.bottom && parti < part.GetCount()) {
if(part[parti].Is<RichTable>()) {
@ -202,7 +201,6 @@ void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const
pi.highlightpara -= l;
pi.sell -= l;
pi.selh -= l;
pos += l;
++parti;
}
}

View file

@ -47,7 +47,6 @@ void TextCompareCtrl::DoSelection(int y, bool shift)
void TextCompareCtrl::LeftDown(Point pt, dword keyflags)
{
Size sz = GetSize();
DoSelection(pt.y, keyflags & K_SHIFT);
SetCapture();
SetWantFocus();

View file

@ -670,7 +670,6 @@ int AssistEditor::ToUtf8x(int line, int pos)
int AssistEditor::FromUtf8x(int line, int pos)
{ // libclang treats utf-8 bytes as whole characters
if(line < GetLineCount() && GetLineLength(line) < 1000) {
bool isutf8 = false;
const String& h = GetUtf8Line(line);
if(pos <= h.GetCount())
for(const char ch : h)
@ -684,7 +683,6 @@ void AssistEditor::Assist(bool macros)
{
LTIMING("Assist");
CloseAssist();
int q = GetCursor32();
assist_type.Clear();
assist_item.Clear();
include_assist = false;
@ -965,7 +963,7 @@ void AssistEditor::AssistInsert()
ch++;
Remove(cl, ch - cl);
SetCursor(cl);
int n = Paste(ToUnicode(txt, CHARSET_WIN1250));
Paste(ToUnicode(txt, CHARSET_WIN1250));
if(param_count > 0) {
SetCursor(GetCursor32() - 1);
StartParamInfo(f, cl);

View file

@ -518,7 +518,6 @@ void ReformatDlg::Set(Stream& in)
int ii = 0;
String master_id;
for(const ClangFormat& f : clang_format) {
int x = 0;
String id = f.id;
if(*id == ' ')
id = master_id + ":" + TrimBoth(id);

View file

@ -15,6 +15,7 @@ struct InsertImageDlg : WithInsertImageLayout<TopWindow>, Display {
bool warning = false;
void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const override;
void Paint(Draw& w) override { return TopWindow::Paint(w); } // silence clang warning
void Layout() override;
void Serialize(Stream& s) override { SerializePlacement(s); s % noupp % index; }

View file

@ -142,7 +142,6 @@ void Navigator::Navigate()
navigating = true;
int ii = list.GetCursor();
if(theide && ii >= 0 && ii < litem.GetCount()) {
int ln = GetCurrentLine() + 1;
const NavItem& m = *litem[ii];
if(m.kind == KIND_NEST) {
String h = m.pretty;
@ -311,8 +310,6 @@ void Navigator::Search()
sortitems.Check(sorting);
String s = TrimBoth(~search);
String search_name, search_nest;
bool wholeclass = false;
bool both = false;
navigator_global = false;
if(s.Find('.') >= 0) {
Vector<String> h = Split((String)~search, '.');
@ -323,12 +320,9 @@ void Navigator::Search()
if(h.GetCount())
search_nest = Join(h, "::");
}
wholeclass = *s == '.' && search_nest.GetCount();
}
else {
else
search_name = ~search;
both = true;
}
s = Join(Split(s, '.'), "::") + (s.EndsWith(".") ? "::" : "");
int lineno = StrInt(s);
nitem.Clear();
@ -348,7 +342,6 @@ void Navigator::Search()
}
else
if(IsNull(s) && !sorting) {
bool sch = GetFileExt(theide->editfile) == ".sch";
Ide *theide = TheIde();
if(theide)
for(const AnnotationItem& m : theide->editor.annotations) {

View file

@ -179,7 +179,6 @@ void Indexer::IndexerThread()
Clang clang;
clang_CXIndex_setGlobalOptions(clang.index, CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
int tm0 = msecs();
bool was_job = false; // for diagnostics
++running_indexers;
while(!Thread::IsShutdownThreads()) {
Job job;
@ -190,7 +189,6 @@ void Indexer::IndexerThread()
job = jobs[jobi++];
else
break;
was_job = true;
}
if(Thread::IsShutdownThreads())

View file

@ -5,6 +5,7 @@
//#BLITZ_PROHIBIT
#ifdef PLATFORM_WIN32
const char umacros[] =
R"(#define CHECK_GRID(g)
#define CHECK_MATRIX(g)
@ -816,6 +817,8 @@ R"(#define CHECK_GRID(g)
#define _stdcall __attribute__((__stdcall__))
#define _thiscall __attribute__((__thiscall__)))";
#endif
String RedefineMacros()
{
String cmdline;

View file

@ -633,7 +633,6 @@ struct IndexerProgress : ImageMaker {
void Ide::SyncClang()
{
Vector<Color> a;
Color display_ink = Null;
int phase = msecs() / 30; // TODO: Use phase
auto AnimColor = [](int animator) {
return Blend(IsDarkTheme() ? GrayColor(70) : SColorLtFace(), Color(198, 170, 0), animator);