From 45caaefb97a09ef41881e69203b30433c1f2069e Mon Sep 17 00:00:00 2001 From: Alan Antonuk Date: Tue, 2 Jun 2015 21:05:26 -0700 Subject: Win32: fixup a few MSVC warnings in test & examples --- examples/amqp_rpc_sendstring_client.c | 2 +- tests/test_parse_url.c | 5 +++++ tests/test_tables.c | 10 ++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/amqp_rpc_sendstring_client.c b/examples/amqp_rpc_sendstring_client.c index 84e7fdd..8a16281 100644 --- a/examples/amqp_rpc_sendstring_client.c +++ b/examples/amqp_rpc_sendstring_client.c @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) } printf("----\n"); - body_target = frame.payload.properties.body_size; + body_target = (size_t)frame.payload.properties.body_size; body_received = 0; while (body_received < body_target) { diff --git a/tests/test_parse_url.c b/tests/test_parse_url.c index cb4f59d..b54ace2 100644 --- a/tests/test_parse_url.c +++ b/tests/test_parse_url.c @@ -36,6 +36,11 @@ #include "config.h" +#ifdef _MSC_VER +/* MSVC complains about strdup being deprecated in favor of _strdup */ +# define _CRT_NONSTDC_NO_DEPRECATE +#endif + #include #include #include diff --git a/tests/test_tables.c b/tests/test_tables.c index cf2509e..cc40410 100644 --- a/tests/test_tables.c +++ b/tests/test_tables.c @@ -34,6 +34,11 @@ * ***** END LICENSE BLOCK ***** */ +#ifdef _MSC_VER +# define _USE_MATH_DEFINES +# define _CRT_SECURE_NO_WARNINGS +#endif + #include #include #include @@ -44,9 +49,6 @@ #include -#ifdef _MSC_VER -#define _USE_MATH_DEFINES -#endif #include void die(const char *fmt, ...) @@ -339,7 +341,7 @@ static void test_table_codec(FILE *out) entries[12].key = amqp_cstring_bytes("float"); entries[12].value.kind = AMQP_FIELD_KIND_F32; - entries[12].value.value.f32 = M_PI; + entries[12].value.value.f32 = (float)M_PI; entries[13].key = amqp_cstring_bytes("double"); entries[13].value.kind = AMQP_FIELD_KIND_F64; -- cgit v1.2.1