From 0ac1392cd81b43d9e74f6b47c6128eaa095104ca Mon Sep 17 00:00:00 2001 From: Andres AG Date: Wed, 8 Feb 2017 14:05:57 +0000 Subject: [PATCH] Remove use of inttypes.h in MSVC from ssl_server2 The sample application programs/ssl/ssl_server2.c was previously modifies to use inttypes.h to parse a string to a 64-bit integer. However, MSVC does not support C99, so compilation fails. This patch modifies the sample app to use the MSVC specific parsing functions instead of inttypes.h. --- programs/ssl/ssl_server2.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 1f6caf2d3..20fec5324 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -61,7 +61,10 @@ int main( void ) #include #include #include + +#if !defined(_MSC_VER) #include +#endif #if !defined(_WIN32) #include @@ -1040,8 +1043,13 @@ int main( int argc, char *argv[] ) } else if( strcmp( p, "renego_period" ) == 0 ) { - if( sscanf( q, "%" SCNu64, &opt.renego_period ) != 1 || - opt.renego_period < 2 ) +#if defined(_MSC_VER) + opt.renego_period = _strtoui64( q, NULL, 10 ); +#else + if( sscanf( q, "%" SCNu64, &opt.renego_period ) != 1 ) + goto usage; +#endif /* _MSC_VER */ + if( opt.renego_period < 2 ) goto usage; } else if( strcmp( p, "exchanges" ) == 0 )