Browse Source

Updating code to PuTTY abfc751c (2nd)

Source commit: 810b19550bbebbb005cd21305c8af3652cadb224
Martin Prikryl 6 năm trước cách đây
mục cha
commit
94ffd797ae

+ 3 - 0
source/Putty.cbproj

@@ -306,6 +306,9 @@
 			<BuildOrder>74</BuildOrder>
 			<BuildOrder>4</BuildOrder>
 		</CppCompile>
+		<CppCompile Include="putty\stripctrl.c">
+			<BuildOrder>81</BuildOrder>
+		</CppCompile>
 		<CppCompile Include="putty\tree234.c">
 			<BuildOrder>77</BuildOrder>
 			<BuildOrder>1</BuildOrder>

+ 3 - 1
source/core/PuttyIntf.cpp

@@ -370,7 +370,9 @@ static const SeatVtable ScpSeatVtable =
     nullseat_echoedit_update,
     nullseat_get_x_display,
     nullseat_get_windowid,
-    nullseat_get_window_pixel_size
+    nullseat_get_window_pixel_size,
+    nullseat_stripctrl_new,
+    nullseat_set_trust_status_vacuously
   };
 //---------------------------------------------------------------------------
 ScpSeat::ScpSeat(TSecureShell * ASecureShell)

+ 1 - 1
source/putty/import.c

@@ -2248,7 +2248,7 @@ static bool sshcom_write(
                         outblob->len - (lenpos + 8));
     /* Pad encrypted blob to a multiple of cipher block size. */
     if (passphrase) {
-	int padding = -(outblob->len - (lenpos+4)) & 7;
+	int padding = -(ssize_t)(outblob->len - (lenpos+4)) & 7; // WINSCP
         uint8_t padding_buf[8];
         random_read(padding_buf, padding);
         put_data(outblob, padding_buf, padding);

+ 2 - 0
source/putty/misc.c

@@ -214,6 +214,7 @@ bool validate_manual_hostkey(char *key)
     return false;
 }
 
+#ifndef WINSCP
 char *buildinfo(const char *newline)
 {
     strbuf *buf = strbuf_new();
@@ -313,6 +314,7 @@ char *buildinfo(const char *newline)
 
     return strbuf_to_str(buf);
 }
+#endif !WINSCP
 
 #ifdef MPEXT
 

+ 2 - 0
source/putty/misc.h

@@ -398,11 +398,13 @@ void stripctrl_retarget(StripCtrlChars *sccpub, BinarySink *new_bs_out);
 void stripctrl_reset(StripCtrlChars *sccpub);
 void stripctrl_free(StripCtrlChars *sanpub);
 void stripctrl_enable_line_limiting(StripCtrlChars *sccpub);
+#ifndef WINSCP
 char *stripctrl_string_ptrlen(StripCtrlChars *sccpub, ptrlen str);
 static inline char *stripctrl_string(StripCtrlChars *sccpub, const char *str)
 {
     return stripctrl_string_ptrlen(sccpub, ptrlen_from_asciz(str));
 }
+#endif
 
 #ifdef MPEXT
 // Recent PuTTY code uses C99 standard that allows code before initialization.

+ 12 - 0
source/putty/stripctrl.c

@@ -12,7 +12,9 @@
 #include <wctype.h>
 
 #include "putty.h"
+#ifndef WINSCP
 #include "terminal.h"
+#endif
 #include "misc.h"
 #include "marshal.h"
 
@@ -29,10 +31,12 @@ struct StripCtrlCharsImpl {
     char buf[SCC_BUFSIZE];
     size_t buflen;
 
+#ifndef WINSCP
     Terminal *term;
     bool last_term_utf;
     struct term_utf8_decode utf8;
     unsigned long (*translate)(Terminal *, term_utf8_decode *, unsigned char);
+#endif
 
     bool line_limit;
     bool line_start;
@@ -59,6 +63,7 @@ static StripCtrlCharsImpl *stripctrl_new_common(
     return scc;
 }
 
+#ifndef WINSCP
 StripCtrlChars *stripctrl_new(
     BinarySink *bs_out, bool permit_cr, wchar_t substitution)
 {
@@ -80,6 +85,7 @@ StripCtrlChars *stripctrl_new_term_fn(
     BinarySink_INIT(&scc->public, stripctrl_term_BinarySink_write);
     return &scc->public;
 }
+#endif
 
 void stripctrl_retarget(StripCtrlChars *sccpub, BinarySink *new_bs_out)
 {
@@ -100,7 +106,9 @@ void stripctrl_reset(StripCtrlChars *sccpub)
      * start converting a fresh piece of data to send to a channel
      * that hasn't seen the previous output.
      */
+#ifndef WINSCP
     memset(&scc->utf8, 0, sizeof(scc->utf8));
+#endif
     memset(&scc->mbs_in, 0, sizeof(scc->mbs_in));
     memset(&scc->mbs_out, 0, sizeof(scc->mbs_out));
 
@@ -126,6 +134,7 @@ void stripctrl_enable_line_limiting(StripCtrlChars *sccpub)
     scc->line_start = true;
 }
 
+#ifndef WINSCP
 static inline bool stripctrl_ctrlchar_ok(StripCtrlCharsImpl *scc, wchar_t wc)
 {
     return wc == L'\n' || (wc == L'\r' && scc->permit_cr);
@@ -306,6 +315,7 @@ static void stripctrl_locale_BinarySink_write(
             to_copy = len;
 
         memcpy(scc->buf + scc->buflen, p, to_copy);
+        { // WINSCP
         size_t consumed = stripctrl_locale_try_consume(
             scc, scc->buf, scc->buflen + to_copy);
 
@@ -355,6 +365,7 @@ static void stripctrl_locale_BinarySink_write(
          */
         scc->buflen -= consumed;
         memmove(scc->buf, scc->buf + consumed, scc->buflen);
+        } // WINSCP
     }
 
     /*
@@ -419,6 +430,7 @@ char *stripctrl_string_ptrlen(StripCtrlChars *sccpub, ptrlen str)
     stripctrl_retarget(sccpub, NULL);
     return strbuf_to_str(out);
 }
+#endif
 
 #ifdef STRIPCTRL_TEST