changeset 1038:d3925ed45a85

Fix for old compilers, variable declarations at beginning of functions and /**/ comments
author Thorsten Horstmann <thorsten.horstmann@web.de>
date Tue, 24 Feb 2015 20:51:18 +0800
parents 7c899f24a85b
children d0e6dd5af46e
files common-algo.c common-channel.c common-session.c curve25519-donna.c dbutil.c keyimport.c svr-chansession.c svr-x11fwd.c
diffstat 8 files changed, 19 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/common-algo.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/common-algo.c	Tue Feb 24 20:51:18 2015 +0800
@@ -87,7 +87,7 @@
 #ifdef DROPBEAR_ENABLE_CBC_MODE
 const struct dropbear_cipher_mode dropbear_mode_cbc =
 	{(void*)cbc_start, (void*)cbc_encrypt, (void*)cbc_decrypt};
-#endif // DROPBEAR_ENABLE_CBC_MODE
+#endif /* DROPBEAR_ENABLE_CBC_MODE */
 
 const struct dropbear_cipher_mode dropbear_mode_none =
 	{void_start, void_cipher, void_cipher};
@@ -102,7 +102,7 @@
 }
 const struct dropbear_cipher_mode dropbear_mode_ctr =
 	{(void*)dropbear_big_endian_ctr_start, (void*)ctr_encrypt, (void*)ctr_decrypt};
-#endif // DROPBEAR_ENABLE_CTR_MODE
+#endif /* DROPBEAR_ENABLE_CTR_MODE */
 
 /* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc.
    {&hash_desc, keysize, hashsize} */
--- a/common-channel.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/common-channel.c	Tue Feb 24 20:51:18 2015 +0800
@@ -402,7 +402,7 @@
 /* Send the close message and set the channel as closed */
 static void send_msg_channel_close(struct Channel *channel) {
 
-	TRACE(("enter send_msg_channel_close %p", channel))
+	TRACE(("enter send_msg_channel_close %p", (void*)channel))
 	if (channel->type->closehandler 
 			&& !channel->close_handler_done) {
 		channel->type->closehandler(channel);
@@ -616,7 +616,7 @@
 
 	channel = getchannel();
 
-	TRACE(("enter recv_msg_channel_request %p", channel))
+	TRACE(("enter recv_msg_channel_request %p", (void*)channel))
 
 	if (channel->sent_close) {
 		TRACE(("leave recv_msg_channel_request: already closed channel"))
@@ -1141,10 +1141,10 @@
 }
 
 struct Channel* get_any_ready_channel() {
+	size_t i;
 	if (ses.chancount == 0) {
 		return NULL;
 	}
-	size_t i;
 	for (i = 0; i < ses.chansize; i++) {
 		struct Channel *chan = ses.channels[i];
 		if (chan
--- a/common-session.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/common-session.c	Tue Feb 24 20:51:18 2015 +0800
@@ -399,15 +399,15 @@
 }
 
 void ignore_recv_response() {
-	// Do nothing
+	/* Do nothing */
 	TRACE(("Ignored msg_request_response"))
 }
 
 static void send_msg_keepalive() {
+	time_t old_time_idle = ses.last_packet_time_idle;
+	struct Channel *chan = get_any_ready_channel();
+
 	CHECKCLEARTOWRITE();
-	time_t old_time_idle = ses.last_packet_time_idle;
-
-	struct Channel *chan = get_any_ready_channel();
 
 	if (chan) {
 		/* Channel requests are preferable, more implementations
--- a/curve25519-donna.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/curve25519-donna.c	Tue Feb 24 20:51:18 2015 +0800
@@ -527,7 +527,7 @@
 
   memcpy(origx, x, 10 * sizeof(limb));
   fsum(x, z);
-  fdifference(z, origx);  // does x - z
+  fdifference(z, origx);  /* does x - z */
 
   memcpy(origxprime, xprime, sizeof(limb) * 10);
   fsum(xprime, zprime);
@@ -554,7 +554,7 @@
   fproduct(x2, xx, zz);
   freduce_degree(x2);
   freduce_coefficients(x2);
-  fdifference(zz, xx);  // does zz = xx - zz
+  fdifference(zz, xx);  /* does zz = xx - zz */
   memset(zzz + 10, 0, sizeof(limb) * 9);
   fscalar_product(zzz, zz, 121665);
   /* No need to call freduce_degree here:
@@ -641,9 +641,9 @@
   memcpy(resultz, nqz, sizeof(limb) * 10);
 }
 
-// -----------------------------------------------------------------------------
-// Shamelessly copied from djb's code
-// -----------------------------------------------------------------------------
+/* -----------------------------------------------------------------------------
+ * Shamelessly copied from djb's code
+ * ----------------------------------------------------------------------------- */
 static void
 crecip(limb *out, const limb *z) {
   limb z2[10];
--- a/dbutil.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/dbutil.c	Tue Feb 24 20:51:18 2015 +0800
@@ -868,12 +868,12 @@
 
 /* make sure that the socket closes */
 void m_close(int fd) {
+	int val;
 
 	if (fd == -1) {
 		return;
 	}
 
-	int val;
 	do {
 		val = close(fd);
 	} while (val < 0 && errno == EINTR);
--- a/keyimport.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/keyimport.c	Tue Feb 24 20:51:18 2015 +0800
@@ -1046,6 +1046,7 @@
 		const void* curve_oid = NULL;
 		unsigned long pubkey_size = 2*curve_size+1;
 		unsigned int k_size;
+		int err = 0;
 
 		/* version. less than 10 bytes */
 		buf_incrwritepos(seq_buf,
@@ -1091,7 +1092,7 @@
 		buf_incrwritepos(seq_buf,
 			ber_write_id_len(buf_getwriteptr(seq_buf, 10), 3, 1+pubkey_size, 0));
 		buf_putbyte(seq_buf, 0);
-		int err = ecc_ansi_x963_export(*eck, buf_getwriteptr(seq_buf, pubkey_size), &pubkey_size);
+		err = ecc_ansi_x963_export(*eck, buf_getwriteptr(seq_buf, pubkey_size), &pubkey_size);
 		if (err != CRYPT_OK) {
 			dropbear_exit("ECC error");
 		}
--- a/svr-chansession.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/svr-chansession.c	Tue Feb 24 20:51:18 2015 +0800
@@ -234,7 +234,7 @@
 
 	struct ChanSess *chansess;
 
-	TRACE(("new chansess %p", channel))
+	TRACE(("new chansess %p", (void*)channel))
 
 	dropbear_assert(channel->typedata == NULL);
 
--- a/svr-x11fwd.c	Tue Feb 24 20:45:07 2015 +0800
+++ b/svr-x11fwd.c	Tue Feb 24 20:51:18 2015 +0800
@@ -175,7 +175,7 @@
 	m_free(chansess->x11authprot);
 	m_free(chansess->x11authcookie);
 
-	TRACE(("chansess %p", chansess))
+	TRACE(("chansess %p", (void*)chansess))
 	if (chansess->x11listener != NULL) {
 		remove_listener(chansess->x11listener);
 		chansess->x11listener = NULL;