diff options
author | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
---|---|---|
committer | David Wragg <dpw@lshift.net> | 2010-05-30 23:31:40 +0100 |
commit | 7e8fbea4c9212774c101e33218d26a0dc992dc03 (patch) | |
tree | 4815bc608e2f3f54187c20142c5c909fa1ab0810 | |
parent | 2347dc9977d3bf0c9ed19f7ed3a905eb4e65fa46 (diff) | |
download | rabbitmq-c-github-ask-7e8fbea4c9212774c101e33218d26a0dc992dc03.tar.gz |
Remove uses of the GNU-specific %ll printf format modifier
The MS C runtime doesn't support it. Use the C99 inttypes.h macros
instead, which is supplied by MinGW.
-rw-r--r-- | examples/amqp_consumer.c | 4 | ||||
-rw-r--r-- | examples/amqp_producer.c | 8 | ||||
-rw-r--r-- | tests/test_tables.c | 28 |
3 files changed, 20 insertions, 20 deletions
diff --git a/examples/amqp_consumer.c b/examples/amqp_consumer.c index 331fe1d..45db990 100644 --- a/examples/amqp_consumer.c +++ b/examples/amqp_consumer.c @@ -84,8 +84,8 @@ static void run(amqp_connection_state_t conn) if (now > next_summary_time) { int countOverInterval = received - previous_received; double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0); - printf("%lld ms: Received %d - %d since last report (%d Hz)\n", - (now - start_time) / 1000, received, countOverInterval, (int) intervalRate); + printf("%d ms: Received %d - %d since last report (%d Hz)\n", + (int)(now - start_time) / 1000, received, countOverInterval, (int) intervalRate); previous_received = received; previous_report_time = now; diff --git a/examples/amqp_producer.c b/examples/amqp_producer.c index 94c529d..61cc925 100644 --- a/examples/amqp_producer.c +++ b/examples/amqp_producer.c @@ -95,8 +95,8 @@ static void send_batch(amqp_connection_state_t conn, if (now > next_summary_time) { int countOverInterval = sent - previous_sent; double intervalRate = countOverInterval / ((now - previous_report_time) / 1000000.0); - printf("%lld ms: Sent %d - %d since last report (%d Hz)\n", - (now - start_time) / 1000, sent, countOverInterval, (int) intervalRate); + printf("%d ms: Sent %d - %d since last report (%d Hz)\n", + (int)(now - start_time) / 1000, sent, countOverInterval, (int) intervalRate); previous_sent = sent; previous_report_time = now; @@ -111,10 +111,10 @@ static void send_batch(amqp_connection_state_t conn, { long long stop_time = now_microseconds(); - long long total_delta = stop_time - start_time; + int total_delta = stop_time - start_time; printf("PRODUCER - Message count: %d\n", message_count); - printf("Total time, milliseconds: %lld\n", total_delta / 1000); + printf("Total time, milliseconds: %d\n", total_delta / 1000); printf("Overall messages-per-second: %g\n", (message_count / (total_delta / 1000000.0))); } } diff --git a/tests/test_tables.c b/tests/test_tables.c index e620443..282aa8f 100644 --- a/tests/test_tables.c +++ b/tests/test_tables.c @@ -54,7 +54,8 @@ #include <time.h> #include <errno.h> -#include <stdint.h> +#include <inttypes.h> + #include <amqp.h> #include <amqp_framing.h> #include <amqp_private.h> @@ -75,13 +76,13 @@ static void dump_value(int indent, amqp_field_value_t v) { putchar(' '); switch (v.kind) { case AMQP_FIELD_KIND_BOOLEAN: puts(v.value.boolean ? "true" : "false"); break; - case AMQP_FIELD_KIND_I8: printf("%d\n", v.value.i8); break; - case AMQP_FIELD_KIND_U8: printf("%d\n", v.value.u8); break; - case AMQP_FIELD_KIND_I16: printf("%d\n", v.value.i16); break; - case AMQP_FIELD_KIND_U16: printf("%d\n", v.value.u16); break; - case AMQP_FIELD_KIND_I32: printf("%ld\n", (long) v.value.i32); break; - case AMQP_FIELD_KIND_U32: printf("%lu\n", (unsigned long) v.value.u32); break; - case AMQP_FIELD_KIND_I64: printf("%lld\n", (long long) v.value.i64); break; + case AMQP_FIELD_KIND_I8: printf("%"PRId8"\n", v.value.i8); break; + case AMQP_FIELD_KIND_U8: printf("%"PRIu8"\n", v.value.u8); break; + case AMQP_FIELD_KIND_I16: printf("%"PRId16"\n", v.value.i16); break; + case AMQP_FIELD_KIND_U16: printf("%"PRIu16"\n", v.value.u16); break; + case AMQP_FIELD_KIND_I32: printf("%"PRId32"\n", v.value.i32); break; + case AMQP_FIELD_KIND_U32: printf("%"PRIu32"\n", v.value.u32); break; + case AMQP_FIELD_KIND_I64: printf("%"PRId64"\n", v.value.i64); break; case AMQP_FIELD_KIND_F32: printf("%g\n", (double) v.value.f32); break; case AMQP_FIELD_KIND_F64: printf("%g\n", v.value.f64); break; case AMQP_FIELD_KIND_DECIMAL: @@ -106,7 +107,7 @@ static void dump_value(int indent, amqp_field_value_t v) { } } break; - case AMQP_FIELD_KIND_TIMESTAMP: printf("%llu\n", (unsigned long long) v.value.u64); break; + case AMQP_FIELD_KIND_TIMESTAMP: printf("%"PRIu64"\n", v.value.u64); break; case AMQP_FIELD_KIND_TABLE: putchar('\n'); { @@ -272,7 +273,7 @@ int main(int argc, char const * const *argv) { if ((sizeof(float) != 4) || (vi.i != 0x40490fdb)) { printf("*** ERROR: single floating point encoding does not work as expected\n"); printf("sizeof float is %lu, float is %g, u32 is 0x%08lx\n", - sizeof(float), + (unsigned long)sizeof(float), vi.f, (unsigned long) vi.i); } @@ -280,10 +281,9 @@ int main(int argc, char const * const *argv) { vl.d = M_PI; if ((sizeof(double) != 8) || (vl.l != 0x400921fb54442d18L)) { printf("*** ERROR: double floating point encoding does not work as expected\n"); - printf("sizeof double is %lu, double is %g, u64 is 0x%16llx\n", - sizeof(double), - vl.d, - (unsigned long long) vl.l); + printf("sizeof double is %lu, double is %g, u64 is 0x%16"PRIx64"\n", + (unsigned long)sizeof(double), + vl.d, vl.l); } test_table_codec(); |