From c1fc9700f5eddaf2cea1efd8bd1e67a1e9c8030d Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 7 Mar 2011 16:16:30 +0000 Subject: Solved debug compilation --- tools/plink/misc.h | 24 ++++++++++++------------ tools/plink/sshbn.c | 6 +++--- tools/plink/winplink.c | 2 ++ 3 files changed, 17 insertions(+), 15 deletions(-) (limited to 'tools') diff --git a/tools/plink/misc.h b/tools/plink/misc.h index 11233147a..fc5b7d53d 100644 --- a/tools/plink/misc.h +++ b/tools/plink/misc.h @@ -92,18 +92,18 @@ void debug_memdump(void *buf, int len, int L); ((unsigned long)(unsigned char)(cp)[3] << 24)) #define PUT_32BIT_LSB_FIRST(cp, value) ( \ - (cp)[0] = (unsigned char)(value), \ - (cp)[1] = (unsigned char)((value) >> 8), \ - (cp)[2] = (unsigned char)((value) >> 16), \ - (cp)[3] = (unsigned char)((value) >> 24) ) + (cp)[0] = (unsigned char)((value)&0xff), \ + (cp)[1] = (unsigned char)(((value) >> 8)&0xff), \ + (cp)[2] = (unsigned char)(((value) >> 16)&0xff), \ + (cp)[3] = (unsigned char)(((value) >> 24)&0xff) ) #define GET_16BIT_LSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0]) | \ ((unsigned long)(unsigned char)(cp)[1] << 8)) #define PUT_16BIT_LSB_FIRST(cp, value) ( \ - (cp)[0] = (unsigned char)(value), \ - (cp)[1] = (unsigned char)((value) >> 8) ) + (cp)[0] = (unsigned char)((value)&0xff), \ + (cp)[1] = (unsigned char)(((value) >> 8)&0xff) ) #define GET_32BIT_MSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0] << 24) | \ @@ -114,16 +114,16 @@ void debug_memdump(void *buf, int len, int L); #define GET_32BIT(cp) GET_32BIT_MSB_FIRST(cp) #define PUT_32BIT_MSB_FIRST(cp, value) ( \ - (cp)[0] = (unsigned char)((value) >> 24), \ - (cp)[1] = (unsigned char)((value) >> 16), \ - (cp)[2] = (unsigned char)((value) >> 8), \ - (cp)[3] = (unsigned char)(value) ) + (cp)[0] = (unsigned char)(((value) >> 24)&0xff), \ + (cp)[1] = (unsigned char)(((value) >> 16)&0xff), \ + (cp)[2] = (unsigned char)(((value) >> 8)&0xff), \ + (cp)[3] = (unsigned char)((value)&0xff) ) #define PUT_32BIT(cp, value) PUT_32BIT_MSB_FIRST(cp, value) #define GET_16BIT_MSB_FIRST(cp) \ - (((unsigned long)(unsigned char)(cp)[0] << 8) | \ - ((unsigned long)(unsigned char)(cp)[1])) + (((unsigned long)(unsigned char)((cp)[0] << 8)&0xff) | \ + ((unsigned long)(unsigned char)((cp)[1])&0xff)) #define PUT_16BIT_MSB_FIRST(cp, value) ( \ (cp)[0] = (unsigned char)((value) >> 8), \ diff --git a/tools/plink/sshbn.c b/tools/plink/sshbn.c index e9ff0cde4..0fe27ec7d 100644 --- a/tools/plink/sshbn.c +++ b/tools/plink/sshbn.c @@ -151,7 +151,7 @@ static void internal_mul(BignumInt *a, BignumInt *b, for (j = len - 1; j >= 0; j--) { t += MUL_WORD(a[i], (BignumDblInt) b[j]); t += (BignumDblInt) c[i + j + 1]; - c[i + j + 1] = (BignumInt) t; + c[i + j + 1] = (BignumInt) (t & 0xffffffff); t = t >> BIGNUM_INT_BITS; } c[i] = (BignumInt) t; @@ -257,9 +257,9 @@ static void internal_mod(BignumInt *a, int alen, t = MUL_WORD(q, m[k]); t += c; c = (unsigned)(t >> BIGNUM_INT_BITS); - if ((BignumInt) t > a[i + k]) + if (((BignumInt)(t&0xffffffff)) > a[i + k]) c++; - a[i + k] -= (BignumInt) t; + a[i + k] -= (BignumInt) (t&0xffffffff); } /* Add back m in case of borrow */ diff --git a/tools/plink/winplink.c b/tools/plink/winplink.c index d1539e441..0ae519ec0 100644 --- a/tools/plink/winplink.c +++ b/tools/plink/winplink.c @@ -729,6 +729,7 @@ int main(int argc, char **argv) #pragma warning(disable:4273) #endif +#ifndef _DEBUG _Check_return_opt_ int __cdecl printf(_In_z_ _Printf_format_string_ const char * pFmt, ...) { static int ConsoleCreated=0; @@ -776,3 +777,4 @@ _Check_return_opt_ int __cdecl printf(_In_z_ _Printf_format_string_ const char * va_start(arglist, pFmt ); return vfprintf(stderr, pFmt, arglist); } +#endif \ No newline at end of file -- cgit v1.2.3