Browse Source

Updating code to PuTTY 59c8df41

Source commit: 3857972e1cbd46ce7574f8b4b6bd03f400d65880
Martin Prikryl 6 years ago
parent
commit
c40fa8b7c3

+ 1 - 1
source/Putty.cbproj

@@ -66,7 +66,7 @@
 		<OutputExt>lib</OutputExt>
 		<ProjectType>CppStaticLibrary</ProjectType>
 		<SanitizedProjectName>Putty</SanitizedProjectName>
-		<TLIB_PageSize>64</TLIB_PageSize>
+		<TLIB_PageSize>128</TLIB_PageSize>
 		<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
 		<VerInfo_Locale>1033</VerInfo_Locale>
 	</PropertyGroup>

+ 5 - 0
source/putty/misc.h

@@ -361,6 +361,10 @@ static inline const char *NULLTOEMPTY(const char *s)
     return s ? s : "";
 }
 
+#ifndef WINSCP
+// This is used in plink/pscp/psftp only, but strangely linker asks for stripctrl_string_ptrlen,
+// even though stripctrl_string is never used in our code.
+
 /* StripCtrlChars, defined in stripctrl.c: an adapter you can put on
  * the front of one BinarySink and which functions as one in turn.
  * Interprets its input as a stream of multibyte characters in the
@@ -378,6 +382,7 @@ static inline char *stripctrl_string(const char *str)
 {
     return stripctrl_string_ptrlen(ptrlen_from_asciz(str));
 }
+#endif
 
 #ifdef MPEXT
 // Recent PuTTY code uses C99 standard that allows code before initialization.

+ 2 - 1
source/putty/mpint.c

@@ -276,7 +276,8 @@ unsigned mp_get_bit(mp_int *x, size_t bit)
 uintmax_t mp_get_integer(mp_int *x)
 {
     uintmax_t toret = 0;
-    for (size_t i = x->nw; i-- > 0 ;) {
+    size_t i; // WINSCP
+    for (i = x->nw; i-- > 0 ;) {
         /* Shift in two stages to avoid undefined behaviour if the
          * shift count equals the integer width */
         toret = (toret << (BIGNUM_INT_BITS/2)) << (BIGNUM_INT_BITS/2);

+ 4 - 4
source/putty/network.h

@@ -173,14 +173,14 @@ static inline void sk_flush(Socket *s)
 
 static inline void plug_log(
     Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)
-{ return p->vt->log(p, type, addr, port, msg, code); }
+{ /*WINSCP return*/ p->vt->log(p, type, addr, port, msg, code); }
 static inline void plug_closing(
     Plug *p, const char *msg, int code, bool calling_back)
-{ return p->vt->closing(p, msg, code, calling_back); }
+{ /*WINSCP return*/ p->vt->closing(p, msg, code, calling_back); }
 static inline void plug_receive(Plug *p, int urg, const char *data, size_t len)
-{ return p->vt->receive(p, urg, data, len); }
+{ /*WINSCP return*/ p->vt->receive(p, urg, data, len); }
 static inline void plug_sent (Plug *p, size_t bufsize)
-{ return p->vt->sent(p, bufsize); }
+{ /*WINSCP return*/ p->vt->sent(p, bufsize); }
 static inline int plug_accepting(Plug *p, accept_fn_t cons, accept_ctx_t ctx)
 { return p->vt->accepting(p, cons, ctx); }
 

+ 4 - 4
source/putty/ssh.h

@@ -659,10 +659,10 @@ static inline void ssh_cipher_decrypt(ssh_cipher *c, void *blk, int len)
 { c->vt->decrypt(c, blk, len); }
 static inline void ssh_cipher_encrypt_length(
     ssh_cipher *c, void *blk, int len, unsigned long seq)
-{ return c->vt->encrypt_length(c, blk, len, seq); }
+{ /*WINSCP return*/ c->vt->encrypt_length(c, blk, len, seq); }
 static inline void ssh_cipher_decrypt_length(
     ssh_cipher *c, void *blk, int len, unsigned long seq)
-{ return c->vt->decrypt_length(c, blk, len, seq); }
+{ /*WINSCP return*/ c->vt->decrypt_length(c, blk, len, seq); }
 static inline const struct ssh_cipheralg *ssh_cipher_alg(ssh_cipher *c)
 { return c->vt; }
 
@@ -742,9 +742,9 @@ static inline ssh_hash *ssh_hash_new(const ssh_hashalg *alg)
 static inline ssh_hash *ssh_hash_copy(ssh_hash *h)
 { return h->vt->copy(h); }
 static inline void ssh_hash_final(ssh_hash *h, unsigned char *out)
-{ return h->vt->final(h, out); }
+{ /*WINSCP return*/ h->vt->final(h, out); }
 static inline void ssh_hash_free(ssh_hash *h)
-{ return h->vt->free(h); }
+{ /*WINSCP return*/ h->vt->free(h); }
 static inline const ssh_hashalg *ssh_hash_alg(ssh_hash *h)
 { return h->vt; }
 

+ 1 - 1
source/putty/sshchan.h

@@ -250,7 +250,7 @@ static inline void sshfwd_x11_sharing_handover(
     SshChannel *c, ssh_sharing_connstate *cs, share_channel *sch,
     const char *addr, int port, int endian, int maj, int min,
     const void *idata, int ilen)
-{ return c->vt->x11_sharing_handover(c, cs, sch, addr, port, endian,
+{ /*WINSCP return*/ c->vt->x11_sharing_handover(c, cs, sch, addr, port, endian,
                                      maj, min, idata, ilen); }
 static inline void sshfwd_send_exit_status(SshChannel *c, int status)
 { c->vt->send_exit_status(c, status); }

+ 2 - 1
source/putty/sshppl.h

@@ -75,7 +75,8 @@ static inline void ssh_ppl_got_user_input(PacketProtocolLayer *ppl)
 { ppl->vt->got_user_input(ppl); }
 static inline void ssh_ppl_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
 { ppl->vt->reconfigure(ppl, conf); }
-#define ssh_ppl_winscp_query(ppl, query) ((ppl)->vt->winscp_query(ppl, query))
+static inline unsigned int ssh_ppl_winscp_query(PacketProtocolLayer *ppl, int query)
+{ return ppl->vt->winscp_query(ppl, query); }
 
 /* ssh_ppl_free is more than just a macro wrapper on the vtable; it
  * does centralised parts of the freeing too. */