diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c
index 604741cc08..540487bc99 100644
--- a/programs/cmm/TWB/TWB.c
+++ b/programs/cmm/TWB/TWB.c
@@ -116,7 +116,7 @@ void TWebBrowser::GetNewUrl(){
if (URL[0] == '/')
{
i = strchr(#newurl+8, '/');
- newurl[i+7]=0;
+ if (i>0) newurl[i+7]=0;
strcpy(#URL, #URL+1);
}
@@ -142,12 +142,19 @@ void TWebBrowser::GetNewUrl(){
void BufEncode(int set_new_encoding)
{
+ int bufpointer_realsize;
cur_encoding = set_new_encoding;
if (o_bufpointer==0)
{
- debugi(bufsize);
- bufsize = strlen(bufpointer);
- debugi(bufsize);
+ bufpointer_realsize = strlen(bufpointer);
+ if (bufpointer_realsize > bufsize)
+ {
+ debug("bufsize: ");
+ debugi(bufsize);
+ debug("bufpointer_realsize: ");
+ debugi(bufpointer_realsize);
+ bufsize = bufpointer_realsize;
+ }
o_bufpointer = malloc(bufsize);
strcpy(o_bufpointer, bufpointer);
}
@@ -412,6 +419,10 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
DrawBuf.Fill(bg_color);
}
} while(GetNextParam());
+ if (opened)
+ {
+ if (cur_encoding==_DEFAULT) BufEncode(_UTF); //if no encoding specified it would be UTF
+ }
return;
}
@@ -630,7 +641,7 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) meta_encoding = _KOI;
if (!strcmp(#options, "windows-1251")) || (!strcmp(#options, "windows1251")) meta_encoding = _WIN;
//if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) meta_encoding = _DOS;
- if ((cur_encoding==_DEFAULT) && (http_transfer==0)) BufEncode(meta_encoding);
+ if (cur_encoding==_DEFAULT) BufEncode(meta_encoding);
return;
}
} while(GetNextParam());
diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c
index 151b2daa51..bd00e82849 100644
--- a/programs/cmm/browser/HTMLv.c
+++ b/programs/cmm/browser/HTMLv.c
@@ -30,14 +30,14 @@
#include "img\URLgoto.txt";
#ifdef LANG_RUS
- char version[]=" Текстовый браузер 0.99.71";
+ char version[]=" Текстовый браузер 0.99.72";
?define IMAGES_CACHE_CLEARED "Кэш картинок очищен"
?define T_LAST_SLIDE "Это последний слайд"
char loading[] = "Загрузка страницы...
";
unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n\0";
#else
- char version[]=" Text-based Browser 0.99.71";
+ char version[]=" Text-based Browser 0.99.72";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...
";
@@ -459,18 +459,15 @@ void ProcessLinks(int id)
void StopLoading()
{
- if (http_transfer<>0)
- {
- EAX = http_transfer;
- EAX = EAX.http_msg.content_ptr; // get pointer to data
- $push EAX // save it on the stack
- http_free stdcall (http_transfer); // abort connection
- $pop EAX
- mem_Free(EAX); // free data
- http_transfer=0;
- bufsize = 0;
- PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
- }
+ EAX = http_transfer;
+ EAX = EAX.http_msg.content_ptr; // get pointer to data
+ $push EAX // save it on the stack
+ http_free stdcall (http_transfer); // abort connection
+ $pop EAX
+ mem_Free(EAX); // free data
+ http_transfer=0;
+ bufsize = 0;
+ PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
}
void SetPageDefaults()
@@ -495,6 +492,13 @@ void OpenPage()
_PutImage(88,10, 24,24, #stop_btn);
http_get stdcall (#URL, #accept_language);
http_transfer = EAX;
+ if (http_transfer == 0)
+ {
+ StopLoading();
+ bufsize = 0;
+ ShowPage();
+ return;
+ }
IF (http_transfer < 0) notify("Error from HTTP lib");
}
else
diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h
index da879dd93b..4a9dba6fa1 100644
--- a/programs/cmm/lib/kolibri.h
+++ b/programs/cmm/lib/kolibri.h
@@ -139,6 +139,12 @@ GETKEYII:
$shr eax,8
}
+inline fastcall int GetFullKey()
+{
+ $mov eax,2
+ $int 0x40
+}
+
inline fastcall pause( EBX)
{
@@ -362,6 +368,26 @@ DONE:
$pop eax
}
+inline fastcall void debug( EDX)
+{
+ $push eax
+ $push ebx
+ $push ecx
+ $mov eax, 63
+ $mov ebx, 1
+NEXT_CHAR:
+ $mov ecx, DSDWORD[edx]
+ $or cl, cl
+ $jz DONE
+ $int 0x40
+ $inc edx
+ $jmp NEXT_CHAR
+DONE:
+ $pop ecx
+ $pop ebx
+ $pop eax
+}
+
inline fastcall void debugch( ECX)
{