summaryrefslogtreecommitdiff
path: root/librabbitmq
diff options
context:
space:
mode:
Diffstat (limited to 'librabbitmq')
-rw-r--r--librabbitmq/Makefile.am8
-rw-r--r--librabbitmq/amqp.h2
-rw-r--r--librabbitmq/amqp_api.c6
-rw-r--r--librabbitmq/amqp_connection.c2
-rw-r--r--librabbitmq/amqp_private.h10
-rw-r--r--librabbitmq/unix/socket.c9
-rw-r--r--librabbitmq/windows/socket.c9
7 files changed, 38 insertions, 8 deletions
diff --git a/librabbitmq/Makefile.am b/librabbitmq/Makefile.am
index 7df78ba..06ade87 100644
--- a/librabbitmq/Makefile.am
+++ b/librabbitmq/Makefile.am
@@ -1,6 +1,14 @@
lib_LTLIBRARIES = librabbitmq.la
AM_CFLAGS = -I$(srcdir)/$(PLATFORM_DIR) -DBUILDING_LIBRABBITMQ
+
+if GCC
+# Because we want to build under Microsoft's C compiler (for which
+# there is apparently no demand for C99 support), it's a good idea
+# to have gcc tell us when we stray from the old standard.
+AM_CFLAGS += -ansi -pedantic
+endif
+
librabbitmq_la_SOURCES = amqp_mem.c amqp_table.c amqp_connection.c amqp_socket.c amqp_debug.c amqp_api.c $(PLATFORM_DIR)/socket.c
librabbitmq_la_LDFLAGS = -no-undefined
librabbitmq_la_LIBADD = $(EXTRA_LIBS)
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 297f745..c20f645 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -181,7 +181,7 @@ typedef enum {
AMQP_FIELD_KIND_TIMESTAMP = 'T',
AMQP_FIELD_KIND_TABLE = 'F',
AMQP_FIELD_KIND_VOID = 'V',
- AMQP_FIELD_KIND_BYTES = 'x',
+ AMQP_FIELD_KIND_BYTES = 'x'
} amqp_field_value_kind_t;
#define _AMQP_TEINIT(ke,ki,v) {.key = (ke), .value = {.kind = AMQP_FIELD_KIND_##ki, .value = {v}}}
diff --git a/librabbitmq/amqp_api.c b/librabbitmq/amqp_api.c
index 32253d1..d74f877 100644
--- a/librabbitmq/amqp_api.c
+++ b/librabbitmq/amqp_api.c
@@ -70,6 +70,12 @@ static const char *client_error_strings[ERROR_MAX] = {
"connection closed unexpectedly", /* ERROR_CONNECTION_CLOSED */
};
+/* strdup is not in ISO C90! */
+static inline char *strdup(const char *str)
+{
+ return strcpy(malloc(strlen(str) + 1),str);
+}
+
char *amqp_error_string(int err)
{
const char *str;
diff --git a/librabbitmq/amqp_connection.c b/librabbitmq/amqp_connection.c
index 8b9ace6..34d12f8 100644
--- a/librabbitmq/amqp_connection.c
+++ b/librabbitmq/amqp_connection.c
@@ -366,7 +366,7 @@ int amqp_send_frame(amqp_connection_state_t state,
/* For a body frame, rather than copying data around, we use
writev to compose the frame */
struct iovec iov[3];
- char frame_end_byte = AMQP_FRAME_END;
+ uint8_t frame_end_byte = AMQP_FRAME_END;
const amqp_bytes_t *body = &frame->payload.body_fragment;
amqp_e32(out_frame, 3, body->len);
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index 61591e5..de2cd5c 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -104,7 +104,7 @@ typedef enum amqp_connection_state_enum_ {
CONNECTION_STATE_IDLE = 0,
CONNECTION_STATE_INITIAL,
CONNECTION_STATE_HEADER,
- CONNECTION_STATE_BODY,
+ CONNECTION_STATE_BODY
} amqp_connection_state_enum;
/* 7 bytes up front, then payload, then 1 byte footer */
@@ -202,8 +202,10 @@ static inline uint64_t func##ll(uint64_t val) \
union { \
uint64_t whole; \
uint32_t halves[2]; \
- } u = { val }; \
- uint32_t t = u.halves[0]; \
+ } u; \
+ uint32_t t; \
+ u.whole = val; \
+ t = u.halves[0]; \
u.halves[0] = func##l(u.halves[1]); \
u.halves[1] = func##l(t); \
return u.whole; \
@@ -212,7 +214,7 @@ static inline uint64_t func##ll(uint64_t val) \
DECLARE_XTOXLL(hton)
DECLARE_XTOXLL(ntoh)
-DECLARE_CODEC_BASE_TYPE(8,,)
+DECLARE_CODEC_BASE_TYPE(8, (uint8_t), (uint8_t))
DECLARE_CODEC_BASE_TYPE(16, htons, ntohs)
DECLARE_CODEC_BASE_TYPE(32, htonl, ntohl)
DECLARE_CODEC_BASE_TYPE(64, htonll, ntohll)
diff --git a/librabbitmq/unix/socket.c b/librabbitmq/unix/socket.c
index 9d37dfc..4f5368e 100644
--- a/librabbitmq/unix/socket.c
+++ b/librabbitmq/unix/socket.c
@@ -53,6 +53,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
+#include <stdlib.h>
#include "amqp.h"
#include "amqp_private.h"
@@ -77,7 +78,13 @@ int amqp_socket_socket(int domain, int type, int proto)
}
return s;
-}
+}
+
+/* strdup is not in ISO C90! */
+static inline char *strdup(const char *str)
+{
+ return strcpy(malloc(strlen(str) + 1),str);
+}
char *amqp_os_error_string(int err)
{
diff --git a/librabbitmq/windows/socket.c b/librabbitmq/windows/socket.c
index 3cc57ba..bef7b95 100644
--- a/librabbitmq/windows/socket.c
+++ b/librabbitmq/windows/socket.c
@@ -53,6 +53,7 @@
#include <windows.h>
#include <stdint.h>
+#include <stdlib.h>
#include "amqp.h"
#include "amqp_private.h"
@@ -67,13 +68,19 @@ int amqp_socket_init(void)
int res = WSAStartup(0x0202, &data);
if (res)
return -res;
-
+
called_wsastartup = 1;
}
return 0;
}
+/* strdup is not in ISO C90! */
+static inline char *strdup(const char *str)
+{
+ return strcpy(malloc(strlen(str) + 1),str);
+}
+
char *amqp_os_error_string(int err)
{
char *msg, *copy;