WebView: fix 2 cases of crash, no space on the link start

git-svn-id: svn://kolibrios.org@8350 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-08 23:32:54 +00:00
parent b26a213fce
commit 294679216a
5 changed files with 17 additions and 17 deletions

View File

@ -158,6 +158,7 @@ void TWebBrowser::AddCharToTheLine(unsigned char _char)
{
if (line[line_len-1]==' ') return; //no double spaces
if (!stolbec) && (!line) return; //no paces at the beginning of the line
if (link) && (line_len==0) return;
}
if (line_len < sizeof(line)) chrcat(#line, _char);
CheckForLineBreak();
@ -468,13 +469,14 @@ void TWebBrowser::SetStyle() {
img.url.add(#img_path);
if (img.w.get_last() / 6 + 1 + stolbec > list.column_max) {
if (img.w.get_last() / 6 + stolbec > list.column_max) {
NewLine();
}
img.x.add(stolbec*list.font_w+3);
img.y.add(draw_y);
stolbec += img.w.get_last() / 6 + 1;
stolbec += img.w.get_last() / 6;
if (stolbec > list.column_max) NewLine();
if (img.h.get_last() > list.item_h) {
draw_y += img.h.get_last() - list.item_h;
@ -488,7 +490,6 @@ void TWebBrowser::SetStyle() {
img.h.get_last(),
0);
//debugval(img.url.get_last(), img.y.get_last());
return;
} else {
@ -511,6 +512,7 @@ void TWebBrowser::SetStyle() {
if (!line) {
if (!strncmp(#img_path, "data:", 5)) img_path=0;
replace_char(#img_path, '?', NULL, strlen(#img_path));
img_path[sizeof(line)-3] = '\0'; //prevent overflow in sprintf
sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/'));
line[50]= NULL;
}

View File

@ -34,6 +34,7 @@ char *unicode_symbols[]={
"#1031", "\244",
"#8211", "-",
"#8212", "-",
"#8217", "'",
"#8220", "\"",
"#8222", "\"", "ldquo", "\"",

View File

@ -42,7 +42,7 @@
// DATA //
// //
//===================================================//
char version[]="WebView 2.8 BETA 2";
char version[]="WebView 2.8 BETA 3";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE

View File

@ -25,11 +25,8 @@ struct DrawBufer {
};
char draw_buf_not_enaught_ram[] =
"'DrawBufer needs more memory than currenly available.
Application could be unstable.
Requested size: %i Mb
Free RAM: %i Mb' -E";
"'DrawBufer requested %i MB more memory than the system has.
Application could be unstable.' -E";
bool DrawBufer::Init(dword i_bufx, i_bufy, i_bufw, i_bufh)
{
@ -189,8 +186,8 @@ void DrawBufer::IncreaseBufSize()
}
free_ram_size = GetFreeRAM() * 1024;
if (alloc_size >= free_ram_size) {
sprintf(#error_str, #draw_buf_not_enaught_ram, alloc_size/1048576, free_ram_size/1048576);
if (alloc_size > free_ram_size) {
sprintf(#error_str, #draw_buf_not_enaught_ram, alloc_size - free_ram_size/1048576);
notify(#error_str);
}
}

View File

@ -207,9 +207,9 @@ void _http::receive()
IF (!strncmp(new_URL,"//", 2))
{
strcpy(#newurl, "http:");
strcat(#newurl, new_URL);
strcpy(orig_URL, #newurl);
strncpy(#newurl, "http:", URL_SIZE);
strncat(#newurl, new_URL, URL_SIZE);
strncpy(orig_URL, #newurl, URL_SIZE);
return orig_URL;
}
@ -236,10 +236,10 @@ void _http::receive()
goto _CUT_ST_LEVEL_MARK;
}
if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
if (newurl[strlen(#newurl)-1]<>'/') strncat(#newurl, "/", URL_SIZE);
strcat(#newurl, new_URL);
strcpy(orig_URL, #newurl);
strncat(#newurl, new_URL, URL_SIZE);
strncpy(orig_URL, #newurl, URL_SIZE);
return orig_URL;
}