From 2a998c5051a42e3dec6382d1b211712425a41642 Mon Sep 17 00:00:00 2001 From: mdelfede Date: Sat, 14 Jun 2008 09:32:32 +0000 Subject: [PATCH] new uvs2 releases : uppsrc-2593 tutorial-38 examples-141 reference-113 git-svn-id: svn://ultimatepp.org/upp/trunk@298 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/AString.hpp | 72 +++++++++++++++++++++------------------ uppsrc/Core/HeapImp.h | 8 ++--- uppsrc/Core/heaputil.cpp | 8 ++--- uppsrc/CtrlLib/PushCtrl.h | 4 ++- uppsrc/CtrlLib/Switch.cpp | 3 +- uppsrc/ide/Goto.cpp | 2 +- 6 files changed, 53 insertions(+), 44 deletions(-) diff --git a/uppsrc/Core/AString.hpp b/uppsrc/Core/AString.hpp index e13ea7d72..6f7eb37db 100644 --- a/uppsrc/Core/AString.hpp +++ b/uppsrc/Core/AString.hpp @@ -111,42 +111,48 @@ int AString::FindFirstOf(int len, const tchar *s, int from) const { ASSERT(from >= 0 && from <= GetLength()); const tchar *ptr = B::Begin(); - const tchar *e = End(); - const tchar *se = s + (len * sizeof(tchar)); - if((s[0] & s[1]) != 0) { - if(s[2] == 0) { - tchar c1 = s[0]; - tchar c2 = s[1]; - for(const tchar *bs = ptr + from; bs < e; bs++) { - tchar ch = *bs; - if(ch == c1 || ch == c2) - return (int)(bs - ptr); - } - return -1; + const tchar *e = B::End(); + const tchar *se = s + len; + if(len == 1) { + tchar c1 = s[0]; + for(const tchar *bs = ptr + from; bs < e; bs++) { + if(*bs == c1) + return (int)(bs - ptr); } - if(s[3] == 0) { - tchar c1 = s[0]; - tchar c2 = s[1]; - tchar c3 = s[2]; - for(const tchar *bs = ptr + from; bs < e; bs++) { - tchar ch = *bs; - if(ch == c1 || ch == c2 || ch == c3) - return (int)(bs - ptr); - } - return -1; + return -1; + } + if(len == 2) { + tchar c1 = s[0]; + tchar c2 = s[1]; + for(const tchar *bs = ptr + from; bs < e; bs++) { + tchar ch = *bs; + if(ch == c1 || ch == c2) + return (int)(bs - ptr); } - if(s[4] == 0) { - tchar c1 = s[0]; - tchar c2 = s[1]; - tchar c3 = s[2]; - tchar c4 = s[3]; - for(const tchar *bs = ptr + from; bs < e; bs++) { - tchar ch = *bs; - if(ch == c1 || ch == c2 || ch == c3 || ch == c4) - return (int)(bs - ptr); - } - return -1; + return -1; + } + if(len == 3) { + tchar c1 = s[0]; + tchar c2 = s[1]; + tchar c3 = s[2]; + for(const tchar *bs = ptr + from; bs < e; bs++) { + tchar ch = *bs; + if(ch == c1 || ch == c2 || ch == c3) + return (int)(bs - ptr); } + return -1; + } + if(len == 4) { + tchar c1 = s[0]; + tchar c2 = s[1]; + tchar c3 = s[2]; + tchar c4 = s[3]; + for(const tchar *bs = ptr + from; bs < e; bs++) { + tchar ch = *bs; + if(ch == c1 || ch == c2 || ch == c3 || ch == c4) + return (int)(bs - ptr); + } + return -1; } for(const tchar *bs = ptr + from; bs < e; bs++) for(const tchar *ss = s; ss < se; ss++) diff --git a/uppsrc/Core/HeapImp.h b/uppsrc/Core/HeapImp.h index 34b8970a2..d5951876a 100644 --- a/uppsrc/Core/HeapImp.h +++ b/uppsrc/Core/HeapImp.h @@ -100,13 +100,13 @@ struct Heap { static Heap aux; #ifdef HEAPDBG - static void DbgFreeFill(void *ptr, int size); - static void DbgFreeCheck(void *ptr, int size); + static void DbgFreeFill(void *ptr, size_t size); + static void DbgFreeCheck(void *ptr, size_t size); static void DbgFreeFillK(void *ptr, int k); static void *DbgFreeCheckK(void *p, int k); #else - static void DbgFreeFill(void *ptr, int size) {} - static void DbgFreeCheck(void *ptr, int size) {} + static void DbgFreeFill(void *ptr, size_t size) {} + static void DbgFreeCheck(void *ptr, size_t size) {} static void DbgFreeFillK(void *ptr, int k) {} static void *DbgFreeCheckK(void *p, int k) { return p; } #endif diff --git a/uppsrc/Core/heaputil.cpp b/uppsrc/Core/heaputil.cpp index 70a4a6013..e823f0147 100644 --- a/uppsrc/Core/heaputil.cpp +++ b/uppsrc/Core/heaputil.cpp @@ -132,17 +132,17 @@ void HeapPanic(const char *text, void *pos, int size) #ifdef HEAPDBG -void Heap::DbgFreeFill(void *p, int size) +void Heap::DbgFreeFill(void *p, size_t size) { - int count = size >> 2; + size_t count = size >> 2; dword *ptr = (dword *)p; while(count--) *ptr++ = 0x65657246; } -void Heap::DbgFreeCheck(void *p, int size) +void Heap::DbgFreeCheck(void *p, size_t size) { - int count = size >> 2; + size_t count = size >> 2; dword *ptr = (dword *)p; while(count--) if(*ptr++ != 0x65657246) diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index 8fdca3a92..29525e2c1 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -264,6 +264,7 @@ private: Vector posx; int linecy; int light; + int mincy; int GetIndex() const; int GetIndex(Point p); @@ -297,8 +298,9 @@ public: operator int() const { return GetData(); } void operator=(const Value& v) { SetData(v); } - Switch& SetFont(Font f) { font = f; return *this; } + Switch& SetFont(Font f) { font = f; Refresh(); return *this; } Font GetFont() const { return font; } + Switch& MinCaseHeight(int cy) { mincy = cy; Refresh(); return *this; } Switch(); virtual ~Switch(); diff --git a/uppsrc/CtrlLib/Switch.cpp b/uppsrc/CtrlLib/Switch.cpp index 4bcfa65c9..b41199f23 100644 --- a/uppsrc/CtrlLib/Switch.cpp +++ b/uppsrc/CtrlLib/Switch.cpp @@ -155,7 +155,7 @@ void Switch::Paint(Draw& w) { if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, SColorFace); int tcy = GetTextSize("W", font).cy; - linecy = max(16, tcy + 2); + linecy = max(mincy, max(16, tcy + 2)); int y = 0; int x = 0; int ty = (linecy - tcy) / 2; @@ -307,6 +307,7 @@ void Switch::CancelMode() { Switch::Switch() { linecy = 16; + mincy = 0; Transparent(); NoInitFocus(); } diff --git a/uppsrc/ide/Goto.cpp b/uppsrc/ide/Goto.cpp index c54150837..d89051f03 100644 --- a/uppsrc/ide/Goto.cpp +++ b/uppsrc/ide/Goto.cpp @@ -51,7 +51,7 @@ void GotoDlg::SyncList() if(IsDigit(*n)) n.Clear(); Index nc; - for(int ci = 0; ci < 2; ci++) + for(int ci = 0; ci < (n.GetCount() ? 2 : 1); ci++) for(int i = 0; i < item.GetCount(); i++) { const CppItemInfo& f = item[i]; int q = memcmp(n, f.name, n.GetLength());