summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2017-12-04 23:23:22 -0800
committerAlan Antonuk <alan.antonuk@gmail.com>2017-12-05 00:19:29 -0800
commitafaab64a3f4c6977d66811cb7235431a085de0b2 (patch)
treee59fbd4ca9cbb8fcb0649329bc2b3c87b0ed3191 /tests
parent67048550b9ac3957fb29b7f9e7bf4b8ee3e9bc73 (diff)
downloadrabbitmq-c-afaab64a3f4c6977d66811cb7235431a085de0b2.tar.gz
Format code with clang-format
Diffstat (limited to 'tests')
-rw-r--r--tests/test_basic.c24
-rw-r--r--tests/test_hostcheck.c14
-rw-r--r--tests/test_merge_capabilities.c34
-rw-r--r--tests/test_parse_url.c154
-rw-r--r--tests/test_sasl_mechanism.c27
-rw-r--r--tests/test_status_enum.c4
-rw-r--r--tests/test_tables.c235
-rw-r--r--tests/win32/msinttypes/inttypes.h455
8 files changed, 442 insertions, 505 deletions
diff --git a/tests/test_basic.c b/tests/test_basic.c
index 2a0a617..a7de044 100644
--- a/tests/test_basic.c
+++ b/tests/test_basic.c
@@ -37,7 +37,7 @@
#endif
#ifdef NDEBUG
-# undef NDEBUG
+#undef NDEBUG
#endif
#include <assert.h>
@@ -54,8 +54,8 @@ amqp_connection_state_t setup_connection_and_channel(void) {
assert(rc == AMQP_STATUS_OK);
amqp_rpc_reply_t rpc_reply = amqp_login(
- connection_state_, "/", 1, AMQP_DEFAULT_FRAME_SIZE, AMQP_DEFAULT_HEARTBEAT,
- AMQP_SASL_METHOD_PLAIN, "guest", "guest");
+ connection_state_, "/", 1, AMQP_DEFAULT_FRAME_SIZE,
+ AMQP_DEFAULT_HEARTBEAT, AMQP_SASL_METHOD_PLAIN, "guest", "guest");
assert(rpc_reply.reply_type == AMQP_RESPONSE_NORMAL);
amqp_channel_open_ok_t *res =
@@ -66,7 +66,8 @@ amqp_connection_state_t setup_connection_and_channel(void) {
}
void close_and_destroy_connection(amqp_connection_state_t connection_state_) {
- amqp_rpc_reply_t rpc_reply = amqp_connection_close(connection_state_, AMQP_REPLY_SUCCESS);
+ amqp_rpc_reply_t rpc_reply =
+ amqp_connection_close(connection_state_, AMQP_REPLY_SUCCESS);
assert(rpc_reply.reply_type == AMQP_RESPONSE_NORMAL);
int rc = amqp_destroy_connection(connection_state_);
@@ -87,9 +88,9 @@ void basic_publish(amqp_connection_state_t connectionState_,
connectionState_, fixed_channel_id, amqp_cstring_bytes(""),
amqp_cstring_bytes(test_queue_name),
/* mandatory=*/1,
- /* immediate=*/0, /* RabbitMQ 3.x does not support the "immediate" flag
- according to
- https://www.rabbitmq.com/specification.html */
+ /* immediate=*/0, /* RabbitMQ 3.x does not support the "immediate" flag
+ according to
+ https://www.rabbitmq.com/specification.html */
&properties, message_bytes);
assert(retval == 0);
@@ -110,7 +111,7 @@ char *basic_get(amqp_connection_state_t connection_state_,
const char *queue_name_, uint64_t *out_body_size_) {
amqp_rpc_reply_t rpc_reply;
amqp_time_t deadline;
- struct timeval timeout = { 5, 0 };
+ struct timeval timeout = {5, 0};
int time_rc = amqp_time_from_now(&deadline, &timeout);
assert(time_rc == AMQP_STATUS_OK);
@@ -125,9 +126,10 @@ char *basic_get(amqp_connection_state_t connection_state_,
assert(rpc_reply.reply.id == AMQP_BASIC_GET_OK_METHOD);
amqp_message_t message;
- rpc_reply = amqp_read_message(connection_state_, fixed_channel_id, &message, 0);
+ rpc_reply =
+ amqp_read_message(connection_state_, fixed_channel_id, &message, 0);
assert(rpc_reply.reply_type == AMQP_RESPONSE_NORMAL);
-
+
char *body = malloc(message.body.len);
memcpy(body, message.body.bytes, message.body.len);
*out_body_size_ = message.body.len;
@@ -163,7 +165,7 @@ char *consume_message(amqp_connection_state_t connection_state_,
assert(result != NULL);
amqp_envelope_t envelope;
- struct timeval timeout = { 5, 0 };
+ struct timeval timeout = {5, 0};
amqp_rpc_reply_t rpc_reply =
amqp_consume_message(connection_state_, &envelope, &timeout, 0);
assert(rpc_reply.reply_type == AMQP_RESPONSE_NORMAL);
diff --git a/tests/test_hostcheck.c b/tests/test_hostcheck.c
index 832db79..24c0d6c 100644
--- a/tests/test_hostcheck.c
+++ b/tests/test_hostcheck.c
@@ -31,13 +31,11 @@
#include <stdio.h>
#include <stdlib.h>
-static void
-hostcheck_success(const char *match_pattern, const char *url)
-{
+static void hostcheck_success(const char *match_pattern, const char *url) {
int ok;
ok = amqp_hostcheck(match_pattern, url);
- if (! ok) {
+ if (!ok) {
fprintf(stderr, "Expected hostname check to pass, but didn't: %s (%s)\n",
url, match_pattern);
abort();
@@ -46,9 +44,7 @@ hostcheck_success(const char *match_pattern, const char *url)
fprintf(stdout, "ok: [success] %s, %s\n", url, match_pattern);
}
-static void
-hostcheck_fail(const char *match_pattern, const char *url)
-{
+static void hostcheck_fail(const char *match_pattern, const char *url) {
int ok;
ok = amqp_hostcheck(match_pattern, url);
@@ -61,9 +57,7 @@ hostcheck_fail(const char *match_pattern, const char *url)
fprintf(stdout, "ok: [fail] %s, %s\n", url, match_pattern);
}
-int
-main(void)
-{
+int main(void) {
hostcheck_success("www.rabbitmq.com", "www.rabbitmq.com");
hostcheck_success("www.rabbitmq.com", "wWw.RaBbItMq.CoM");
hostcheck_success("*.rabbitmq.com", "wWw.RaBbItMq.CoM");
diff --git a/tests/test_merge_capabilities.c b/tests/test_merge_capabilities.c
index e36f758..d62fcd3 100644
--- a/tests/test_merge_capabilities.c
+++ b/tests/test_merge_capabilities.c
@@ -86,23 +86,21 @@ static int compare_field_value(amqp_field_value_t result,
case AMQP_FIELD_KIND_UTF8:
case AMQP_FIELD_KIND_BYTES:
return compare_bytes(result.value.bytes, expect.value.bytes);
- case AMQP_FIELD_KIND_ARRAY:
- {
- int i;
- if (result.value.array.num_entries != expect.value.array.num_entries) {
+ case AMQP_FIELD_KIND_ARRAY: {
+ int i;
+ if (result.value.array.num_entries != expect.value.array.num_entries) {
+ return 0;
+ }
+ for (i = 0; i < result.value.array.num_entries; ++i) {
+ if (!compare_field_value(result.value.array.entries[i],
+ expect.value.array.entries[i])) {
return 0;
}
- for (i = 0; i < result.value.array.num_entries; ++i) {
- if (!compare_field_value(result.value.array.entries[i],
- expect.value.array.entries[i])) {
- return 0;
- }
- }
- return 1;
}
+ return 1;
+ }
case AMQP_FIELD_KIND_TABLE:
- return compare_amqp_table(&result.value.table,
- &expect.value.table);
+ return compare_amqp_table(&result.value.table, &expect.value.table);
case AMQP_FIELD_KIND_VOID:
return 1;
}
@@ -163,7 +161,8 @@ int main(void) {
amqp_table_entry_t expect_entries[4];
sub_base_entries[0] = amqp_table_construct_utf8_entry("foo", "bar");
- sub_base.num_entries = sizeof(sub_base_entries) / sizeof(amqp_table_entry_t);
+ sub_base.num_entries =
+ sizeof(sub_base_entries) / sizeof(amqp_table_entry_t);
sub_base.entries = sub_base_entries;
sub_add_entries[0] = amqp_table_construct_utf8_entry("something", "else");
@@ -172,8 +171,10 @@ int main(void) {
sub_add.entries = sub_add_entries;
sub_expect_entries[0] = amqp_table_construct_utf8_entry("foo", "baz");
- sub_expect_entries[1] = amqp_table_construct_utf8_entry("something", "else");
- sub_expect.num_entries = sizeof(sub_expect_entries) / sizeof(amqp_table_entry_t);
+ sub_expect_entries[1] =
+ amqp_table_construct_utf8_entry("something", "else");
+ sub_expect.num_entries =
+ sizeof(sub_expect_entries) / sizeof(amqp_table_entry_t);
sub_expect.entries = sub_expect_entries;
base_entries[0] = amqp_table_construct_utf8_entry("product", "1.0");
@@ -200,4 +201,3 @@ int main(void) {
fprintf(stderr, "ok\n");
return 0;
}
-
diff --git a/tests/test_parse_url.c b/tests/test_parse_url.c
index 73dace0..9cdc87c 100644
--- a/tests/test_parse_url.c
+++ b/tests/test_parse_url.c
@@ -37,50 +37,42 @@
#ifdef _MSC_VER
/* MSVC complains about strdup being deprecated in favor of _strdup */
-# define _CRT_NONSTDC_NO_DEPRECATE
+#define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <inttypes.h>
#include <amqp.h>
-static void match_string(const char *what, const char *expect, const char *got)
-{
+static void match_string(const char *what, const char *expect,
+ const char *got) {
if (strcmp(got, expect)) {
- fprintf(stderr, "Expected %s '%s', got '%s'\n",
- what, expect, got);
+ fprintf(stderr, "Expected %s '%s', got '%s'\n", what, expect, got);
abort();
}
}
-static void match_int(const char *what, int expect, int got)
-{
+static void match_int(const char *what, int expect, int got) {
if (got != expect) {
- fprintf(stderr, "Expected %s '%d', got '%d'\n",
- what, expect, got);
+ fprintf(stderr, "Expected %s '%d', got '%d'\n", what, expect, got);
abort();
}
}
-static void parse_success(const char *url,
- const char *user,
- const char *password,
- const char *host,
- int port,
- const char *vhost)
-{
+static void parse_success(const char *url, const char *user,
+ const char *password, const char *host, int port,
+ const char *vhost) {
char *s = strdup(url);
struct amqp_connection_info ci;
int res;
res = amqp_parse_url(s, &ci);
if (res) {
- fprintf(stderr,
- "Expected to successfully parse URL, but didn't: %s (%s)\n",
+ fprintf(stderr, "Expected to successfully parse URL, but didn't: %s (%s)\n",
url, amqp_error_string2(res));
abort();
}
@@ -94,34 +86,30 @@ static void parse_success(const char *url,
free(s);
}
-static void parse_fail(const char *url)
-{
+static void parse_fail(const char *url) {
char *s = strdup(url);
struct amqp_connection_info ci;
amqp_default_connection_info(&ci);
if (amqp_parse_url(s, &ci) >= 0) {
- fprintf(stderr,
- "Expected to fail parsing URL, but didn't: %s\n",
- url);
+ fprintf(stderr, "Expected to fail parsing URL, but didn't: %s\n", url);
abort();
}
free(s);
}
-int main(void)
-{
+int main(void) {
/* From the spec */
- parse_success("amqp://user:pass@host:10000/vhost", "user", "pass",
- "host", 10000, "vhost");
- parse_success("amqps://user:pass@host:10000/vhost", "user", "pass",
- "host", 10000, "vhost");
+ parse_success("amqp://user:pass@host:10000/vhost", "user", "pass", "host",
+ 10000, "vhost");
+ parse_success("amqps://user:pass@host:10000/vhost", "user", "pass", "host",
+ 10000, "vhost");
- parse_success("amqp://user%61:%61pass@ho%61st:10000/v%2fhost",
- "usera", "apass", "hoast", 10000, "v/host");
- parse_success("amqps://user%61:%61pass@ho%61st:10000/v%2fhost",
- "usera", "apass", "hoast", 10000, "v/host");
+ parse_success("amqp://user%61:%61pass@ho%61st:10000/v%2fhost", "usera",
+ "apass", "hoast", 10000, "v/host");
+ parse_success("amqps://user%61:%61pass@ho%61st:10000/v%2fhost", "usera",
+ "apass", "hoast", 10000, "v/host");
parse_success("amqp://", "guest", "guest", "localhost", 5672, "/");
parse_success("amqps://", "guest", "guest", "localhost", 5671, "/");
@@ -132,23 +120,17 @@ int main(void)
parse_success("amqp://user@", "user", "guest", "localhost", 5672, "/");
parse_success("amqps://user@", "user", "guest", "localhost", 5671, "/");
- parse_success("amqp://user:pass@", "user", "pass",
- "localhost", 5672, "/");
- parse_success("amqps://user:pass@", "user", "pass",
- "localhost", 5671, "/");
+ parse_success("amqp://user:pass@", "user", "pass", "localhost", 5672, "/");
+ parse_success("amqps://user:pass@", "user", "pass", "localhost", 5671, "/");
parse_success("amqp://host", "guest", "guest", "host", 5672, "/");
parse_success("amqps://host", "guest", "guest", "host", 5671, "/");
- parse_success("amqp://:10000", "guest", "guest", "localhost", 10000,
- "/");
- parse_success("amqps://:10000", "guest", "guest", "localhost", 10000,
- "/");
+ parse_success("amqp://:10000", "guest", "guest", "localhost", 10000, "/");
+ parse_success("amqps://:10000", "guest", "guest", "localhost", 10000, "/");
- parse_success("amqp:///vhost", "guest", "guest", "localhost", 5672,
- "vhost");
- parse_success("amqps:///vhost", "guest", "guest", "localhost", 5671,
- "vhost");
+ parse_success("amqp:///vhost", "guest", "guest", "localhost", 5672, "vhost");
+ parse_success("amqps:///vhost", "guest", "guest", "localhost", 5671, "vhost");
parse_success("amqp://host/", "guest", "guest", "host", 5672, "");
parse_success("amqps://host/", "guest", "guest", "host", 5671, "");
@@ -166,55 +148,37 @@ int main(void)
parse_success("amqp://[::1]:100", "guest", "guest", "::1", 100, "/");
parse_success("amqps://[::1]:100", "guest", "guest", "::1", 100, "/");
- parse_success("amqp://host/blah", "guest", "guest",
- "host", 5672, "blah");
- parse_success("amqps://host/blah", "guest", "guest",
- "host", 5671, "blah");
-
- parse_success("amqp://host:100/blah", "guest", "guest",
- "host", 100, "blah");
- parse_success("amqps://host:100/blah", "guest", "guest",
- "host", 100, "blah");
-
- parse_success("amqp://:100/blah", "guest", "guest",
- "localhost", 100, "blah");
- parse_success("amqps://:100/blah", "guest", "guest",
- "localhost", 100, "blah");
-
- parse_success("amqp://[::1]/blah", "guest", "guest",
- "::1", 5672, "blah");
- parse_success("amqps://[::1]/blah", "guest", "guest",
- "::1", 5671, "blah");
-
- parse_success("amqp://[::1]:100/blah", "guest", "guest",
- "::1", 100, "blah");
- parse_success("amqps://[::1]:100/blah", "guest", "guest",
- "::1", 100, "blah");
-
- parse_success("amqp://user:pass@host", "user", "pass",
- "host", 5672, "/");
- parse_success("amqps://user:pass@host", "user", "pass",
- "host", 5671, "/");
-
- parse_success("amqp://user:pass@host:100", "user", "pass",
- "host", 100, "/");
- parse_success("amqps://user:pass@host:100", "user", "pass",
- "host", 100, "/");
-
- parse_success("amqp://user:pass@:100", "user", "pass",
- "localhost", 100, "/");
- parse_success("amqps://user:pass@:100", "user", "pass",
- "localhost", 100, "/");
-
- parse_success("amqp://user:pass@[::1]", "user", "pass",
- "::1", 5672, "/");
- parse_success("amqps://user:pass@[::1]", "user", "pass",
- "::1", 5671, "/");
-
- parse_success("amqp://user:pass@[::1]:100", "user", "pass",
- "::1", 100, "/");
- parse_success("amqps://user:pass@[::1]:100", "user", "pass",
- "::1", 100, "/");
+ parse_success("amqp://host/blah", "guest", "guest", "host", 5672, "blah");
+ parse_success("amqps://host/blah", "guest", "guest", "host", 5671, "blah");
+
+ parse_success("amqp://host:100/blah", "guest", "guest", "host", 100, "blah");
+ parse_success("amqps://host:100/blah", "guest", "guest", "host", 100, "blah");
+
+ parse_success("amqp://:100/blah", "guest", "guest", "localhost", 100, "blah");
+ parse_success("amqps://:100/blah", "guest", "guest", "localhost", 100,
+ "blah");
+
+ parse_success("amqp://[::1]/blah", "guest", "guest", "::1", 5672, "blah");
+ parse_success("amqps://[::1]/blah", "guest", "guest", "::1", 5671, "blah");
+
+ parse_success("amqp://[::1]:100/blah", "guest", "guest", "::1", 100, "blah");
+ parse_success("amqps://[::1]:100/blah", "guest", "guest", "::1", 100, "blah");
+
+ parse_success("amqp://user:pass@host", "user", "pass", "host", 5672, "/");
+ parse_success("amqps://user:pass@host", "user", "pass", "host", 5671, "/");
+
+ parse_success("amqp://user:pass@host:100", "user", "pass", "host", 100, "/");
+ parse_success("amqps://user:pass@host:100", "user", "pass", "host", 100, "/");
+
+ parse_success("amqp://user:pass@:100", "user", "pass", "localhost", 100, "/");
+ parse_success("amqps://user:pass@:100", "user", "pass", "localhost", 100,
+ "/");
+
+ parse_success("amqp://user:pass@[::1]", "user", "pass", "::1", 5672, "/");
+ parse_success("amqps://user:pass@[::1]", "user", "pass", "::1", 5671, "/");
+
+ parse_success("amqp://user:pass@[::1]:100", "user", "pass", "::1", 100, "/");
+ parse_success("amqps://user:pass@[::1]:100", "user", "pass", "::1", 100, "/");
/* Various failure cases */
parse_fail("http://www.rabbitmq.com");
diff --git a/tests/test_sasl_mechanism.c b/tests/test_sasl_mechanism.c
index b9cb2ec..7848219 100644
--- a/tests/test_sasl_mechanism.c
+++ b/tests/test_sasl_mechanism.c
@@ -34,25 +34,21 @@
*/
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <amqp_socket.h>
static void parse_success(amqp_bytes_t mechanisms,
- amqp_sasl_method_enum method)
-{
+ amqp_sasl_method_enum method) {
if (!sasl_mechanism_in_list(mechanisms, method)) {
- fprintf(stderr,
- "Expected to find mechanism in list, but didn't: %s\n",
+ fprintf(stderr, "Expected to find mechanism in list, but didn't: %s\n",
(char *)mechanisms.bytes);
abort();
}
}
-static void parse_fail(amqp_bytes_t mechanisms,
- amqp_sasl_method_enum method)
-{
+static void parse_fail(amqp_bytes_t mechanisms, amqp_sasl_method_enum method) {
if (sasl_mechanism_in_list(mechanisms, method)) {
fprintf(stderr,
"Expected the mechanism not on the list, but it was present: %s\n",
@@ -61,11 +57,14 @@ static void parse_fail(amqp_bytes_t mechanisms,
}
}
-int main(void)
-{
- parse_success(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"), AMQP_SASL_METHOD_PLAIN);
- parse_fail(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"), AMQP_SASL_METHOD_EXTERNAL);
- parse_success(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 EXTERNAL"), AMQP_SASL_METHOD_EXTERNAL);
- parse_fail(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 EXTERNAL"), AMQP_SASL_METHOD_PLAIN);
+int main(void) {
+ parse_success(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"),
+ AMQP_SASL_METHOD_PLAIN);
+ parse_fail(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN"),
+ AMQP_SASL_METHOD_EXTERNAL);
+ parse_success(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 EXTERNAL"),
+ AMQP_SASL_METHOD_EXTERNAL);
+ parse_fail(amqp_cstring_bytes("DIGEST-MD5 CRAM-MD5 EXTERNAL"),
+ AMQP_SASL_METHOD_PLAIN);
return 0;
}
diff --git a/tests/test_status_enum.c b/tests/test_status_enum.c
index 136c760..2f2dbd7 100644
--- a/tests/test_status_enum.c
+++ b/tests/test_status_enum.c
@@ -37,9 +37,7 @@ static void check_errorstrings(amqp_status_enum start, amqp_status_enum end) {
for (i = start; i > end; --i) {
const char* err = amqp_error_string2(i);
if (0 == strcmp(err, "(unknown error)")) {
- printf("amqp_status_enum value %s%X",
- i < 0 ? "-" : "",
- (unsigned)i);
+ printf("amqp_status_enum value %s%X", i < 0 ? "-" : "", (unsigned)i);
abort();
}
}
diff --git a/tests/test_tables.c b/tests/test_tables.c
index 4cd0dda..89ece6b 100644
--- a/tests/test_tables.c
+++ b/tests/test_tables.c
@@ -34,15 +34,15 @@
*/
#ifdef _MSC_VER
-# define _USE_MATH_DEFINES
-# define _CRT_SECURE_NO_WARNINGS
+#define _USE_MATH_DEFINES
+#define _CRT_SECURE_NO_WARNINGS
#endif
-#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <stdarg.h>
-#include <errno.h>
#include <inttypes.h>
@@ -50,8 +50,7 @@
#include <math.h>
-void die(const char *fmt, ...)
-{
+void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@@ -60,8 +59,7 @@ void die(const char *fmt, ...)
abort();
}
-static void dump_indent(int indent, FILE *out)
-{
+static void dump_indent(int indent, FILE *out) {
int i;
for (i = 0; i < indent; i++) {
@@ -69,109 +67,106 @@ static void dump_indent(int indent, FILE *out)
}
}
-static void dump_value(int indent, amqp_field_value_t v, FILE *out)
-{
+static void dump_value(int indent, amqp_field_value_t v, FILE *out) {
int i;
dump_indent(indent, out);
fputc(v.kind, out);
switch (v.kind) {
- case AMQP_FIELD_KIND_BOOLEAN:
- fputs(v.value.boolean ? " true\n" : " false\n", out);
- break;
+ case AMQP_FIELD_KIND_BOOLEAN:
+ fputs(v.value.boolean ? " true\n" : " false\n", out);
+ break;
- case AMQP_FIELD_KIND_I8:
- fprintf(out, " %"PRId8"\n", v.value.i8);
- break;
+ case AMQP_FIELD_KIND_I8:
+ fprintf(out, " %" PRId8 "\n", v.value.i8);
+ break;
- case AMQP_FIELD_KIND_U8:
- fprintf(out, " %"PRIu8"\n", v.value.u8);
- break;
+ case AMQP_FIELD_KIND_U8:
+ fprintf(out, " %" PRIu8 "\n", v.value.u8);
+ break;
- case AMQP_FIELD_KIND_I16:
- fprintf(out, " %"PRId16"\n", v.value.i16);
- break;
+ case AMQP_FIELD_KIND_I16:
+ fprintf(out, " %" PRId16 "\n", v.value.i16);
+ break;
- case AMQP_FIELD_KIND_U16:
- fprintf(out, " %"PRIu16"\n", v.value.u16);
- break;
+ case AMQP_FIELD_KIND_U16:
+ fprintf(out, " %" PRIu16 "\n", v.value.u16);
+ break;
- case AMQP_FIELD_KIND_I32:
- fprintf(out, " %"PRId32"\n", v.value.i32);
- break;
+ case AMQP_FIELD_KIND_I32:
+ fprintf(out, " %" PRId32 "\n", v.value.i32);
+ break;
- case AMQP_FIELD_KIND_U32:
- fprintf(out, " %"PRIu32"\n", v.value.u32);
- break;
+ case AMQP_FIELD_KIND_U32:
+ fprintf(out, " %" PRIu32 "\n", v.value.u32);
+ break;
- case AMQP_FIELD_KIND_I64:
- fprintf(out, " %"PRId64"\n", v.value.i64);
- break;
+ case AMQP_FIELD_KIND_I64:
+ fprintf(out, " %" PRId64 "\n", v.value.i64);
+ break;
- case AMQP_FIELD_KIND_F32:
- fprintf(out, " %g\n", (double) v.value.f32);
- break;
+ case AMQP_FIELD_KIND_F32:
+ fprintf(out, " %g\n", (double)v.value.f32);
+ break;
- case AMQP_FIELD_KIND_F64:
- fprintf(out, " %g\n", v.value.f64);
- break;
+ case AMQP_FIELD_KIND_F64:
+ fprintf(out, " %g\n", v.value.f64);
+ break;
- case AMQP_FIELD_KIND_DECIMAL:
- fprintf(out, " %u:::%u\n", v.value.decimal.decimals,
- v.value.decimal.value);
- break;
+ case AMQP_FIELD_KIND_DECIMAL:
+ fprintf(out, " %u:::%u\n", v.value.decimal.decimals,
+ v.value.decimal.value);
+ break;
- case AMQP_FIELD_KIND_UTF8:
- fprintf(out, " %.*s\n", (int)v.value.bytes.len,
- (char *)v.value.bytes.bytes);
- break;
+ case AMQP_FIELD_KIND_UTF8:
+ fprintf(out, " %.*s\n", (int)v.value.bytes.len,
+ (char *)v.value.bytes.bytes);
+ break;
- case AMQP_FIELD_KIND_BYTES:
- fputc(' ', out);
- for (i = 0; i < (int)v.value.bytes.len; i++) {
- fprintf(out, "%02x", ((char *) v.value.bytes.bytes)[i]);
- }
+ case AMQP_FIELD_KIND_BYTES:
+ fputc(' ', out);
+ for (i = 0; i < (int)v.value.bytes.len; i++) {
+ fprintf(out, "%02x", ((char *)v.value.bytes.bytes)[i]);
+ }
- fputc('\n', out);
- break;
+ fputc('\n', out);
+ break;
- case AMQP_FIELD_KIND_ARRAY:
- fputc('\n', out);
- for (i = 0; i < v.value.array.num_entries; i++) {
- dump_value(indent + 2, v.value.array.entries[i], out);
- }
+ case AMQP_FIELD_KIND_ARRAY:
+ fputc('\n', out);
+ for (i = 0; i < v.value.array.num_entries; i++) {
+ dump_value(indent + 2, v.value.array.entries[i], out);
+ }
- break;
+ break;
- case AMQP_FIELD_KIND_TIMESTAMP:
- fprintf(out, " %"PRIu64"\n", v.value.u64);
- break;
+ case AMQP_FIELD_KIND_TIMESTAMP:
+ fprintf(out, " %" PRIu64 "\n", v.value.u64);
+ break;
- case AMQP_FIELD_KIND_TABLE:
- fputc('\n', out);
- for (i = 0; i < v.value.table.num_entries; i++) {
- dump_indent(indent + 2, out);
- fprintf(out, "%.*s ->\n",
- (int)v.value.table.entries[i].key.len,
- (char *)v.value.table.entries[i].key.bytes);
- dump_value(indent + 4, v.value.table.entries[i].value, out);
- }
+ case AMQP_FIELD_KIND_TABLE:
+ fputc('\n', out);
+ for (i = 0; i < v.value.table.num_entries; i++) {
+ dump_indent(indent + 2, out);
+ fprintf(out, "%.*s ->\n", (int)v.value.table.entries[i].key.len,
+ (char *)v.value.table.entries[i].key.bytes);
+ dump_value(indent + 4, v.value.table.entries[i].value, out);
+ }
- break;
+ break;
- case AMQP_FIELD_KIND_VOID:
- fputc('\n', out);
- break;
+ case AMQP_FIELD_KIND_VOID:
+ fputc('\n', out);
+ break;
- default:
- fprintf(out, "???\n");
- break;
+ default:
+ fprintf(out, "???\n");
+ break;
}
}
-static void test_dump_value(FILE *out)
-{
+static void test_dump_value(FILE *out) {
amqp_table_entry_t entries[8];
amqp_table_t table;
amqp_field_value_t val;
@@ -212,7 +207,8 @@ static void test_dump_value(FILE *out)
table.num_entries = 8;
table.entries = entries;
- qsort(table.entries, table.num_entries, sizeof(amqp_table_entry_t), &amqp_table_entry_cmp);
+ qsort(table.entries, table.num_entries, sizeof(amqp_table_entry_t),
+ &amqp_table_entry_cmp);
val.kind = AMQP_FIELD_KIND_TABLE;
val.value.table = table;
@@ -221,43 +217,30 @@ static void test_dump_value(FILE *out)
}
static uint8_t pre_encoded_table[] = {
- 0x00, 0x00, 0x00, 0xff, 0x07, 0x6c, 0x6f, 0x6e,
- 0x67, 0x73, 0x74, 0x72, 0x53, 0x00, 0x00, 0x00,
- 0x15, 0x48, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73,
- 0x20, 0x61, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
- 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x09, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x64, 0x69, 0x6e, 0x74,
- 0x49, 0x00, 0x00, 0x30, 0x39, 0x07, 0x64, 0x65,
- 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x44, 0x03, 0x00,
- 0x01, 0xe2, 0x40, 0x09, 0x74, 0x69, 0x6d, 0x65,
- 0x73, 0x74, 0x61, 0x6d, 0x70, 0x54, 0x00, 0x00,
- 0x63, 0xee, 0xa0, 0x53, 0xc1, 0x94, 0x05, 0x74,
- 0x61, 0x62, 0x6c, 0x65, 0x46, 0x00, 0x00, 0x00,
- 0x1f, 0x03, 0x6f, 0x6e, 0x65, 0x49, 0x00, 0x00,
- 0xd4, 0x31, 0x03, 0x74, 0x77, 0x6f, 0x53, 0x00,
- 0x00, 0x00, 0x0d, 0x41, 0x20, 0x6c, 0x6f, 0x6e,
- 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
- 0x04, 0x62, 0x79, 0x74, 0x65, 0x62, 0xff, 0x04,
- 0x6c, 0x6f, 0x6e, 0x67, 0x6c, 0x00, 0x00, 0x00,
- 0x00, 0x49, 0x96, 0x02, 0xd2, 0x05, 0x73, 0x68,
- 0x6f, 0x72, 0x74, 0x73, 0x02, 0x8f, 0x04, 0x62,
- 0x6f, 0x6f, 0x6c, 0x74, 0x01, 0x06, 0x62, 0x69,
- 0x6e, 0x61, 0x72, 0x79, 0x78, 0x00, 0x00, 0x00,
- 0x0f, 0x61, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72,
- 0x79, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
- 0x04, 0x76, 0x6f, 0x69, 0x64, 0x56, 0x05, 0x61,
- 0x72, 0x72, 0x61, 0x79, 0x41, 0x00, 0x00, 0x00,
- 0x17, 0x49, 0x00, 0x00, 0xd4, 0x31, 0x53, 0x00,
- 0x00, 0x00, 0x0d, 0x41, 0x20, 0x6c, 0x6f, 0x6e,
- 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
- 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x66, 0x40,
- 0x49, 0x0f, 0xdb, 0x06, 0x64, 0x6f, 0x75, 0x62,
- 0x6c, 0x65, 0x64, 0x40, 0x09, 0x21, 0xfb, 0x54,
- 0x44, 0x2d, 0x18
-};
-
-static void test_table_codec(FILE *out)
-{
+ 0x00, 0x00, 0x00, 0xff, 0x07, 0x6c, 0x6f, 0x6e, 0x67, 0x73, 0x74, 0x72,
+ 0x53, 0x00, 0x00, 0x00, 0x15, 0x48, 0x65, 0x72, 0x65, 0x20, 0x69, 0x73,
+ 0x20, 0x61, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x73, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x69, 0x6e, 0x74,
+ 0x49, 0x00, 0x00, 0x30, 0x39, 0x07, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61,
+ 0x6c, 0x44, 0x03, 0x00, 0x01, 0xe2, 0x40, 0x09, 0x74, 0x69, 0x6d, 0x65,
+ 0x73, 0x74, 0x61, 0x6d, 0x70, 0x54, 0x00, 0x00, 0x63, 0xee, 0xa0, 0x53,
+ 0xc1, 0x94, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x00, 0x00, 0x00,
+ 0x1f, 0x03, 0x6f, 0x6e, 0x65, 0x49, 0x00, 0x00, 0xd4, 0x31, 0x03, 0x74,
+ 0x77, 0x6f, 0x53, 0x00, 0x00, 0x00, 0x0d, 0x41, 0x20, 0x6c, 0x6f, 0x6e,
+ 0x67, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x04, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0xff, 0x04, 0x6c, 0x6f, 0x6e, 0x67, 0x6c, 0x00, 0x00, 0x00,
+ 0x00, 0x49, 0x96, 0x02, 0xd2, 0x05, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x73,
+ 0x02, 0x8f, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x74, 0x01, 0x06, 0x62, 0x69,
+ 0x6e, 0x61, 0x72, 0x79, 0x78, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x20, 0x62,
+ 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x04, 0x76, 0x6f, 0x69, 0x64, 0x56, 0x05, 0x61, 0x72, 0x72, 0x61, 0x79,
+ 0x41, 0x00, 0x00, 0x00, 0x17, 0x49, 0x00, 0x00, 0xd4, 0x31, 0x53, 0x00,
+ 0x00, 0x00, 0x0d, 0x41, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x73, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x66, 0x40,
+ 0x49, 0x0f, 0xdb, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x64, 0x40,
+ 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18};
+
+static void test_table_codec(FILE *out) {
amqp_pool_t pool;
int result;
@@ -367,8 +350,8 @@ static void test_table_codec(FILE *out)
decoding_bytes.len = sizeof(pre_encoded_table);
decoding_bytes.bytes = pre_encoded_table;
- result = amqp_decode_table(decoding_bytes, &pool, &decoded,
- &decoding_offset);
+ result =
+ amqp_decode_table(decoding_bytes, &pool, &decoded, &decoding_offset);
if (result < 0) {
die("Table decoding failed: %s", amqp_error_string2(result));
}
@@ -413,8 +396,7 @@ static void test_table_codec(FILE *out)
#define CHUNK_SIZE 4096
-static int compare_files(FILE *f1_in, FILE *f2_in)
-{
+static int compare_files(FILE *f1_in, FILE *f2_in) {
char f1_buf[CHUNK_SIZE];
char f2_buf[CHUNK_SIZE];
int res;
@@ -444,8 +426,7 @@ static int compare_files(FILE *f1_in, FILE *f2_in)
const char *expected_file_name = "tests/test_tables.expected";
-int main(void)
-{
+int main(void) {
char *srcdir = getenv("srcdir");
FILE *out, *expected = NULL;
char *expected_path;
diff --git a/tests/win32/msinttypes/inttypes.h b/tests/win32/msinttypes/inttypes.h
index 4b3828a..f437cf4 100644
--- a/tests/win32/msinttypes/inttypes.h
+++ b/tests/win32/msinttypes/inttypes.h
@@ -1,39 +1,39 @@
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
-// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
-//
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
// Copyright (c) 2006 Alexander Chemeris
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-//
+//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-//
+//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-//
+//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
+//
///////////////////////////////////////////////////////////////////////////////
-#ifndef _MSC_VER // [
+#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
-#endif // _MSC_VER ]
+#endif // _MSC_VER ]
-#ifndef _MSC_INTTYPES_H_ // [
+#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
#if _MSC_VER > 1000
@@ -45,223 +45,224 @@
// 7.8 Format conversion of integer types
typedef struct {
- intmax_t quot;
- intmax_t rem;
+ intmax_t quot;
+ intmax_t rem;
} imaxdiv_t;
// 7.8.1 Macros for format specifiers
-#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
+#if !defined(__cplusplus) || \
+ defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
// The fprintf macros for signed integers are:
-#define PRId8 "d"
-#define PRIi8 "i"
-#define PRIdLEAST8 "d"
-#define PRIiLEAST8 "i"
-#define PRIdFAST8 "d"
-#define PRIiFAST8 "i"
-
-#define PRId16 "hd"
-#define PRIi16 "hi"
-#define PRIdLEAST16 "hd"
-#define PRIiLEAST16 "hi"
-#define PRIdFAST16 "hd"
-#define PRIiFAST16 "hi"
-
-#define PRId32 "I32d"
-#define PRIi32 "I32i"
-#define PRIdLEAST32 "I32d"
-#define PRIiLEAST32 "I32i"
-#define PRIdFAST32 "I32d"
-#define PRIiFAST32 "I32i"
-
-#define PRId64 "I64d"
-#define PRIi64 "I64i"
-#define PRIdLEAST64 "I64d"
-#define PRIiLEAST64 "I64i"
-#define PRIdFAST64 "I64d"
-#define PRIiFAST64 "I64i"
-
-#define PRIdMAX "I64d"
-#define PRIiMAX "I64i"
-
-#define PRIdPTR "Id"
-#define PRIiPTR "Ii"
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
// The fprintf macros for unsigned integers are:
-#define PRIo8 "o"
-#define PRIu8 "u"
-#define PRIx8 "x"
-#define PRIX8 "X"
-#define PRIoLEAST8 "o"
-#define PRIuLEAST8 "u"
-#define PRIxLEAST8 "x"
-#define PRIXLEAST8 "X"
-#define PRIoFAST8 "o"
-#define PRIuFAST8 "u"
-#define PRIxFAST8 "x"
-#define PRIXFAST8 "X"
-
-#define PRIo16 "ho"
-#define PRIu16 "hu"
-#define PRIx16 "hx"
-#define PRIX16 "hX"
-#define PRIoLEAST16 "ho"
-#define PRIuLEAST16 "hu"
-#define PRIxLEAST16 "hx"
-#define PRIXLEAST16 "hX"
-#define PRIoFAST16 "ho"
-#define PRIuFAST16 "hu"
-#define PRIxFAST16 "hx"
-#define PRIXFAST16 "hX"
-
-#define PRIo32 "I32o"
-#define PRIu32 "I32u"
-#define PRIx32 "I32x"
-#define PRIX32 "I32X"
-#define PRIoLEAST32 "I32o"
-#define PRIuLEAST32 "I32u"
-#define PRIxLEAST32 "I32x"
-#define PRIXLEAST32 "I32X"
-#define PRIoFAST32 "I32o"
-#define PRIuFAST32 "I32u"
-#define PRIxFAST32 "I32x"
-#define PRIXFAST32 "I32X"
-
-#define PRIo64 "I64o"
-#define PRIu64 "I64u"
-#define PRIx64 "I64x"
-#define PRIX64 "I64X"
-#define PRIoLEAST64 "I64o"
-#define PRIuLEAST64 "I64u"
-#define PRIxLEAST64 "I64x"
-#define PRIXLEAST64 "I64X"
-#define PRIoFAST64 "I64o"
-#define PRIuFAST64 "I64u"
-#define PRIxFAST64 "I64x"
-#define PRIXFAST64 "I64X"
-
-#define PRIoMAX "I64o"
-#define PRIuMAX "I64u"
-#define PRIxMAX "I64x"
-#define PRIXMAX "I64X"
-
-#define PRIoPTR "Io"
-#define PRIuPTR "Iu"
-#define PRIxPTR "Ix"
-#define PRIXPTR "IX"
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
// The fscanf macros for signed integers are:
-#define SCNd8 "d"
-#define SCNi8 "i"
-#define SCNdLEAST8 "d"
-#define SCNiLEAST8 "i"
-#define SCNdFAST8 "d"
-#define SCNiFAST8 "i"
-
-#define SCNd16 "hd"
-#define SCNi16 "hi"
-#define SCNdLEAST16 "hd"
-#define SCNiLEAST16 "hi"
-#define SCNdFAST16 "hd"
-#define SCNiFAST16 "hi"
-
-#define SCNd32 "ld"
-#define SCNi32 "li"
-#define SCNdLEAST32 "ld"
-#define SCNiLEAST32 "li"
-#define SCNdFAST32 "ld"
-#define SCNiFAST32 "li"
-
-#define SCNd64 "I64d"
-#define SCNi64 "I64i"
-#define SCNdLEAST64 "I64d"
-#define SCNiLEAST64 "I64i"
-#define SCNdFAST64 "I64d"
-#define SCNiFAST64 "I64i"
-
-#define SCNdMAX "I64d"
-#define SCNiMAX "I64i"
-
-#ifdef _WIN64 // [
-# define SCNdPTR "I64d"
-# define SCNiPTR "I64i"
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64 // [
+#define SCNdPTR "I64d"
+#define SCNiPTR "I64i"
#else // _WIN64 ][
-# define SCNdPTR "ld"
-# define SCNiPTR "li"
+#define SCNdPTR "ld"
+#define SCNiPTR "li"
#endif // _WIN64 ]
// The fscanf macros for unsigned integers are:
-#define SCNo8 "o"
-#define SCNu8 "u"
-#define SCNx8 "x"
-#define SCNX8 "X"
-#define SCNoLEAST8 "o"
-#define SCNuLEAST8 "u"
-#define SCNxLEAST8 "x"
-#define SCNXLEAST8 "X"
-#define SCNoFAST8 "o"
-#define SCNuFAST8 "u"
-#define SCNxFAST8 "x"
-#define SCNXFAST8 "X"
-
-#define SCNo16 "ho"
-#define SCNu16 "hu"
-#define SCNx16 "hx"
-#define SCNX16 "hX"
-#define SCNoLEAST16 "ho"
-#define SCNuLEAST16 "hu"
-#define SCNxLEAST16 "hx"
-#define SCNXLEAST16 "hX"
-#define SCNoFAST16 "ho"
-#define SCNuFAST16 "hu"
-#define SCNxFAST16 "hx"
-#define SCNXFAST16 "hX"
-
-#define SCNo32 "lo"
-#define SCNu32 "lu"
-#define SCNx32 "lx"
-#define SCNX32 "lX"
-#define SCNoLEAST32 "lo"
-#define SCNuLEAST32 "lu"
-#define SCNxLEAST32 "lx"
-#define SCNXLEAST32 "lX"
-#define SCNoFAST32 "lo"
-#define SCNuFAST32 "lu"
-#define SCNxFAST32 "lx"
-#define SCNXFAST32 "lX"
-
-#define SCNo64 "I64o"
-#define SCNu64 "I64u"
-#define SCNx64 "I64x"
-#define SCNX64 "I64X"
-#define SCNoLEAST64 "I64o"
-#define SCNuLEAST64 "I64u"
-#define SCNxLEAST64 "I64x"
-#define SCNXLEAST64 "I64X"
-#define SCNoFAST64 "I64o"
-#define SCNuFAST64 "I64u"
-#define SCNxFAST64 "I64x"
-#define SCNXFAST64 "I64X"
-
-#define SCNoMAX "I64o"
-#define SCNuMAX "I64u"
-#define SCNxMAX "I64x"
-#define SCNXMAX "I64X"
-
-#ifdef _WIN64 // [
-# define SCNoPTR "I64o"
-# define SCNuPTR "I64u"
-# define SCNxPTR "I64x"
-# define SCNXPTR "I64X"
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64 // [
+#define SCNoPTR "I64o"
+#define SCNuPTR "I64u"
+#define SCNxPTR "I64x"
+#define SCNXPTR "I64X"
#else // _WIN64 ][
-# define SCNoPTR "lo"
-# define SCNuPTR "lu"
-# define SCNxPTR "lx"
-# define SCNXPTR "lX"
+#define SCNoPTR "lo"
+#define SCNuPTR "lu"
+#define SCNxPTR "lx"
+#define SCNXPTR "lX"
#endif // _WIN64 ]
-#endif // __STDC_FORMAT_MACROS ]
+#endif // __STDC_FORMAT_MACROS ]
// 7.8.2 Functions for greatest-width integer types
@@ -272,25 +273,24 @@ typedef struct {
// This is modified version of div() function from Microsoft's div.c found
// in %MSVC.NET%\crt\src\div.c
-#ifdef STATIC_IMAXDIV // [
+#ifdef STATIC_IMAXDIV // [
static
-#else // STATIC_IMAXDIV ][
+#else // STATIC_IMAXDIV ][
_inline
-#endif // STATIC_IMAXDIV ]
-imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
-{
- imaxdiv_t result;
+#endif // STATIC_IMAXDIV ]
+ imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) {
+ imaxdiv_t result;
- result.quot = numer / denom;
- result.rem = numer % denom;
+ result.quot = numer / denom;
+ result.rem = numer % denom;
- if (numer < 0 && result.rem > 0) {
- // did division wrong; must fix up
- ++result.quot;
- result.rem -= denom;
- }
+ if (numer < 0 && result.rem > 0) {
+ // did division wrong; must fix up
+ ++result.quot;
+ result.rem -= denom;
+ }
- return result;
+ return result;
}
// 7.8.2.3 The strtoimax and strtoumax functions
@@ -301,5 +301,4 @@ imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
#define wcstoimax _wcstoi64
#define wcstoumax _wcstoui64
-
-#endif // _MSC_INTTYPES_H_ ]
+#endif // _MSC_INTTYPES_H_ ]