From fd987781a37b7d1b504442889f85e9cc2c354982 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 10 Aug 2015 15:59:20 +0000 Subject: [PATCH] CMM: utf8_strlen() optimization git-svn-id: svn://kolibrios.org@5713 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/history.h | 4 +--- programs/cmm/browser/WebView.c | 18 +++++++++------- programs/cmm/lib/strings.h | 38 +++++++++++++++------------------- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/programs/cmm/TWB/history.h b/programs/cmm/TWB/history.h index 916a5dd451..da6375bfcd 100644 --- a/programs/cmm/TWB/history.h +++ b/programs/cmm/TWB/history.h @@ -15,7 +15,7 @@ struct UrlsHistory { void AddUrl(); byte GoBack(); byte GoForward(); -}; +} BrowserHistory; dword UrlsHistory::CurrentUrl() { return #history_list[current].Item; @@ -63,5 +63,3 @@ byte UrlsHistory::GoForward() { strlcpy(#URL, #history_list[current].Item, sizeof(URL)); return 1; } - -UrlsHistory BrowserHistory; \ No newline at end of file diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 1fbdcf370e..990c447c0e 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -403,6 +403,15 @@ void Scan(dword id__) OpenPage(); return; + case REFRESH: + if (http_transfer > 0) + { + StopLoading(); + Draw_Window(); + } + else OpenPage(); + return; + /* case 011: //Ctrk+K BufEncode(CH_KOI8); @@ -451,14 +460,7 @@ void Scan(dword id__) return; case 054: //F5 IF(address_box.flags & 0b10) return; - case REFRESH: - if (http_transfer > 0) - { - StopLoading(); - Draw_Window(); - } - else OpenPage(); - return; + case 020: case NEWTAB: MoveSize(190,80,OLD,OLD); diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index d55d74d513..c3dd417d3f 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -11,6 +11,7 @@ // strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test" // strcmp( ESI, EDI) // strlen( EDI) +// utf8_strlen( ESI) // strcpy( EDI, ESI) --- 0 if == // strncpy(dword text1,text2,signed length) // strcat( EDI, ESI) @@ -140,6 +141,22 @@ inline strnlen(dword str, dword maxlen) return cp - str; } +inline fastcall unsigned int utf8_strlen( ESI) +{ + $xor ecx, ecx + _loop: + $lodsb + $test al, al + $jz _done + $and al, 0xc0 + $cmp al, 0x80 + $jz _loop + $inc ecx + $jmp _loop + + _done: + return ECX; +} inline signed int strcmp(dword text1, text2) { @@ -916,27 +933,6 @@ inline void debugi(dword d_int) } -inline fastcall unsigned int utf8_strlen( ESI) -{ - $xor ecx, ecx - _loop: - $lodsb - $test al, al - $jz _done - $test al, 0x80 - $jz _1 - $and al, 0xc0 - $cmp al, 0x80 - $jz _loop - _1: - $inc ecx - $jmp _loop - - _done: - return ECX; -} - - #define strnmov strmovn #define stricmp strcmpi #define strcmpn strncmp