From 3b314ebaf83909cd0a27560f43789178cfd517b2 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 24 Nov 2021 10:52:23 +0000 Subject: [PATCH] IMG: - replace netcode.obj by base64.obj - add lib/libcrash.obj WEBVIEW: - use custom utf8rutodos() if iconv() failed (the case for forum.old-dos.ru) git-svn-id: svn://kolibrios.org@9304 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 3 ++- data/common/lib/netcode.obj | Bin 919 -> 0 bytes programs/cmm/browser/TWB/TWB.c | 7 +++---- programs/cmm/browser/const.h | 2 +- programs/cmm/lib/obj/iconv.h | 30 +++++++++++++++--------------- programs/cmm/lib/obj/netcode.h | 4 +--- 6 files changed, 22 insertions(+), 24 deletions(-) delete mode 100644 data/common/lib/netcode.obj diff --git a/data/Tupfile.lua b/data/Tupfile.lua index ef0c3efd78..8ced44f28f 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -39,7 +39,6 @@ img_files = { {"FONTS/TAHOMA.KF", "common/fonts/tahoma.kf"}, {"LIB/ICONV.OBJ", "common/lib/iconv.obj"}, {"LIB/KMENU.OBJ", "common/lib/kmenu.obj"}, - {"LIB/NETCODE.OBJ", "common/lib/netcode.obj"}, {"LIB/PIXLIB.OBJ", "common/lib/pixlib.obj"}, {"MEDIA/IMGF/IMGF", "common/media/ImgF/ImgF"}, {"MEDIA/IMGF/CEDG.OBJ", "common/media/ImgF/cEdg.obj"}, @@ -486,6 +485,7 @@ tup.append_table(img_files, { {"LIB/CNV_PNG.OBJ", PROGS .. "/media/zsea/plugins/png/cnv_png.obj"}, {"LIB/DLL.OBJ", PROGS .. "/develop/libraries/dll/dll.obj"}, {"LIB/HTTP.OBJ", PROGS .. "/develop/libraries/http/http.obj"}, + {"LIB/LIBCRASH.OBJ", PROGS .. "/develop/libraries/libcrash/libcrash.obj"}, {"LIB/LIBGFX.OBJ", PROGS .. "/develop/libraries/libs-dev/libgfx/libgfx.obj"}, {"LIB/LIBIMG.OBJ", PROGS .. "/develop/libraries/libs-dev/libimg/libimg.obj"}, {"LIB/LIBINI.OBJ", PROGS .. "/develop/libraries/libs-dev/libini/libini.obj"}, @@ -722,6 +722,7 @@ end -- tup.getconfig('NO_TCC') ~= 'full' if tup.getconfig('NO_GCC') ~= 'full' then tup.append_table(img_files, { {"GAMES/REVERSI", PROGS .. "/games/reversi/trunk/reversi"}, + {"LIB/BASE64.OBJ", PROGS .. "/develop/libraries/base64/base64.obj"}, {"LIB/LIBC.OBJ", PROGS .. "/develop/ktcc/trunk/libc.obj/source/libc.obj"}, {"LIB/MTAR.OBJ", PROGS .. "/develop/libraries/microtar/mtar.obj"}, }) diff --git a/data/common/lib/netcode.obj b/data/common/lib/netcode.obj deleted file mode 100644 index 854239d8b0a193f641d596650a926307bf7f9229..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 919 zcmV;I18Dq9P(w>52mk;<0001AJOC#5VqPKvWOCRWnme(e>8WlYEDXU|rl)z(Mp>2+y z2i&KBtWHUD@q#BuQN*gdMG@5G%?*9Vpiih~&`=Eme&2=aBx0|)e)IO(1BsD*2GDb# zmwB?UmG2#vo;im-Y
vxw^EUa2Th!ay%`{x`I{4f*SgDx=vDN>|e+P;n&z~^!Iyn0186zOigMU=8cG8&{m~Qeg(UbWu%ddFisYLcJB2K}*k$yUaleWbdCl zyitZsi(lu~RiFba7-x_C)?^oOV%w}G1i$pw-5wy{fQVWl-dk2$y6(@h_P)Ep{%qY{ zk?XgdvB>_bxIob6qz21$1r1;5R zFSVTCF15DRLrnXloz>#Xuc&#zp%jd#Ed2xslUQ_r`sq$A^e`1QGo!K>Wp$h{TC}?b zt})FntO$!EbE>*@KShIZenhv3a|&csYU-E6EkO`v`S{#yM-eEUng9>`*evcHB>HsV z3`MBsv?;kPH50P`BKRp3GaI2k=%sxiUv14sV4O7k`PhH|h`9Ldc)zN{wU2Vp5iBt> z*{@&Us=fE~kc=btSZ6>XyZr3MX3$C*hS(cfb#EoAAmptSO8W8Sdap1M^#C7=kp8T{ zexecUa}Sd^Fk`kd3)NiL3ZO>?tL|U)grH{KkxM%@N8xqdEO*ukPGUSU%RE=>pfFa( z(ME^ES%AJi>49y-w_g0&zKbZou`>-VC+)ou3r9Ix(4di<1};*x&DceBQ<`Yq*QZVx tYQC`;*H!El)?f{&RFfM80ENq}KY%Ame+|NX35XJ8^qx`U01E&B006s-#S;Jk diff --git a/programs/cmm/browser/TWB/TWB.c b/programs/cmm/browser/TWB/TWB.c index 4a97ccbc53..f8344d8f64 100644 --- a/programs/cmm/browser/TWB/TWB.c +++ b/programs/cmm/browser/TWB/TWB.c @@ -148,7 +148,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){ cur_encoding = CH_CP866; if (custom_encoding != -1) { cur_encoding = custom_encoding; - bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer); + bufpointer = ChangeCharset(cur_encoding, CH_CP866, bufpointer); bufsize = strlen(bufpointer); } } @@ -197,7 +197,6 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){ #tag.name, draw_x, draw_y, #linebuf)); } //*/ - RenderTextbuf(); if (debug_mode) { debugch('<'); if(!tag.opened)debugch('/'); debug(#tag.name); debugln(">"); } $push cur_encoding @@ -257,9 +256,9 @@ void TWebBrowser::ChangeEncoding(int _new_encoding) { if (cur_encoding == _new_encoding) return; cur_encoding = _new_encoding; - bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer); + bufpointer = ChangeCharset(cur_encoding, CH_CP866, bufpointer); if (header) { - ChangeCharset(cur_encoding, "CP866", #header); + ChangeCharset(cur_encoding, CH_CP866, #header); DrawTitle(#header); } } diff --git a/programs/cmm/browser/const.h b/programs/cmm/browser/const.h index 33a4ad8ea5..3e2e0e1cfd 100644 --- a/programs/cmm/browser/const.h +++ b/programs/cmm/browser/const.h @@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw"; #define DEFAULT_URL URL_SERVICE_HOMEPAGE -char version[]="WebView 3.62"; \ No newline at end of file +char version[]="WebView 3.62b"; \ No newline at end of file diff --git a/programs/cmm/lib/obj/iconv.h b/programs/cmm/lib/obj/iconv.h index 138d8f210a..b57ccef031 100644 --- a/programs/cmm/lib/obj/iconv.h +++ b/programs/cmm/lib/obj/iconv.h @@ -6,6 +6,10 @@ #include "../lib/kolibri.h" #endif +#ifndef INCLUDE_ENCODING_H +#include "../lib/encoding.h" +#endif + dword iconv_lib = #a_iconv_lib; char a_iconv_lib[]="/sys/lib/iconv.obj"; @@ -23,32 +27,28 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf) { dword cd, in_len, out_len, new_buf; - from_chs = from_chs*10+#charsets; - - //debug("iconv: from_chs = "); debugln(from_chs); - //debug("iconv: to_chs = "); debugln(to_chs); - - iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 + iconv_open stdcall (from_chs*10+#charsets, to_chs*10+#charsets); if (EAX==-1) { debugln("iconv: unsupported charset"); return 0; } cd = EAX; - in_len = out_len = strlen(conv_buf)+1; - new_buf = mem_Alloc(in_len); + in_len = strlen(conv_buf)+1; + out_len = in_len * 2; + new_buf = mem_Alloc(out_len); iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len); if (EAX!=0) { cd = EAX; - debugval("iconv: something is wrong with stdcall iconv()", cd); - debugval("in_len", in_len); - debugval("out_len", out_len); - new_buf = free(new_buf); - return conv_buf; + debugval("iconv failed", cd); + if (from_chs == CH_UTF8) && (to_chs == CH_CP866) { + utf8rutodos(conv_buf); + } + } else { + strcpy(conv_buf, new_buf); } - strcpy(conv_buf, new_buf); - free(new_buf); + free(new_buf); return conv_buf; } diff --git a/programs/cmm/lib/obj/netcode.h b/programs/cmm/lib/obj/netcode.h index e2591d174d..cb18f0bfe8 100644 --- a/programs/cmm/lib/obj/netcode.h +++ b/programs/cmm/lib/obj/netcode.h @@ -10,16 +10,14 @@ #include "../lib/dll.h" #endif dword netcode_lib = #a_netcode_lib; -char a_netcode_lib[]="/sys/lib/netcode.obj"; +char a_netcode_lib[]="/sys/lib/base64.obj"; dword base64_encode = #aBase64_encode; dword base64_decode = #aBase64_decode; -dword qp_decode = #aQp_decode; $DD 2 dup 0 char aBase64_encode[] = "base64_encode"; char aBase64_decode[] = "base64_decode"; -char aQp_decode[] = "qp_decode"; /*int base64_encode(char inp[], char outp[], int len); Кодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp.