From 640f0d513984e1a35cda8fe1dd67e80f5f4c7bf6 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 23 Mar 2017 22:25:47 +0200 Subject: [PATCH] Compile modutil.c as C++ --- include/maxscale/buffer.h | 4 ++-- server/core/CMakeLists.txt | 3 ++- server/core/buffer.cc | 2 +- server/core/{modutil.c => modutil.cc} | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 15 deletions(-) rename server/core/{modutil.c => modutil.cc} (98%) diff --git a/include/maxscale/buffer.h b/include/maxscale/buffer.h index 7230a708b..56098f395 100644 --- a/include/maxscale/buffer.h +++ b/include/maxscale/buffer.h @@ -326,9 +326,9 @@ extern GWBUF *gwbuf_split(GWBUF **buf, size_t length); * Set given type to all buffers on the list. * * * @param buf The shared buffer - * @param type Type to be added + * @param type Type to be added, mask of @c gwbuf_type_t values. */ -extern void gwbuf_set_type(GWBUF *head, gwbuf_type_t type); +extern void gwbuf_set_type(GWBUF *head, uint32_t type); /** * Add a property to a buffer. diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index 0980e6667..d2633e4b5 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -18,7 +18,8 @@ add_library(maxscale-common SHARED maxscale_pcre2.cc misc.cc mlist.cc - modutil.c monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c) + modutil.cc + monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c) if(WITH_JEMALLOC) target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES}) diff --git a/server/core/buffer.cc b/server/core/buffer.cc index 817c86c5f..58b67d78e 100644 --- a/server/core/buffer.cc +++ b/server/core/buffer.cc @@ -643,7 +643,7 @@ gwbuf_rtrim(GWBUF *head, unsigned int n_bytes) return rval; } -void gwbuf_set_type(GWBUF* buf, gwbuf_type_t type) +void gwbuf_set_type(GWBUF* buf, uint32_t type) { /** Set type consistenly to all buffers on the list */ while (buf != NULL) diff --git a/server/core/modutil.c b/server/core/modutil.cc similarity index 98% rename from server/core/modutil.c rename to server/core/modutil.cc index c7075d9c7..35694c8d8 100644 --- a/server/core/modutil.c +++ b/server/core/modutil.cc @@ -46,11 +46,11 @@ static const char* sub_single = "$1."; static const char* sub_escape = "\\."; static void modutil_reply_routing_error( - DCB* backend_dcb, - int error, - char* state, - char* errstr, - uint32_t flags); + DCB* backend_dcb, + int error, + const char* state, + char* errstr, + uint32_t flags); /** @@ -329,7 +329,7 @@ modutil_get_query(GWBUF *buf) char* query_str = NULL; packet = GWBUF_DATA(buf); - packet_type = packet[4]; + packet_type = (mysql_server_cmd_t)packet[4]; switch (packet_type) { @@ -758,11 +758,11 @@ void modutil_reply_auth_error(DCB* backend_dcb, * @param errstr Plain-text string error * @param flags GWBUF type flags */ -static void modutil_reply_routing_error(DCB* backend_dcb, - int error, - char* state, - char* errstr, - uint32_t flags) +static void modutil_reply_routing_error(DCB* backend_dcb, + int error, + const char* state, + char* errstr, + uint32_t flags) { GWBUF* buf; CHK_DCB(backend_dcb);