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
This commit is contained in:
mdelfede 2008-06-14 09:32:32 +00:00
parent 38339f828a
commit 2a998c5051
6 changed files with 53 additions and 44 deletions

View file

@ -111,10 +111,17 @@ int AString<B>::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) {
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);
}
return -1;
}
if(len == 2) {
tchar c1 = s[0];
tchar c2 = s[1];
for(const tchar *bs = ptr + from; bs < e; bs++) {
@ -124,7 +131,7 @@ int AString<B>::FindFirstOf(int len, const tchar *s, int from) const
}
return -1;
}
if(s[3] == 0) {
if(len == 3) {
tchar c1 = s[0];
tchar c2 = s[1];
tchar c3 = s[2];
@ -135,7 +142,7 @@ int AString<B>::FindFirstOf(int len, const tchar *s, int from) const
}
return -1;
}
if(s[4] == 0) {
if(len == 4) {
tchar c1 = s[0];
tchar c2 = s[1];
tchar c3 = s[2];
@ -147,7 +154,6 @@ int AString<B>::FindFirstOf(int len, const tchar *s, int from) const
}
return -1;
}
}
for(const tchar *bs = ptr + from; bs < e; bs++)
for(const tchar *ss = s; ss < se; ss++)
if(*bs == *ss)

View file

@ -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

View file

@ -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)

View file

@ -264,6 +264,7 @@ private:
Vector<int> 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();

View file

@ -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();
}

View file

@ -51,7 +51,7 @@ void GotoDlg::SyncList()
if(IsDigit(*n))
n.Clear();
Index<String> 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());