Skip to content

Commit

Permalink
emergency fix to issue #219 on macos compilations and MHD
Browse files Browse the repository at this point in the history
  • Loading branch information
jariarkko committed Nov 9, 2020
1 parent 48b74ba commit 0f17e09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ foreach(FLAG
-pipe
-I/opt/local/include
-Wall -Wextra -Wpedantic -Weverything -Werror
-Wno-unknown-warning-option
-fno-diagnostics-color
-fno-omit-frame-pointer
-fno-optimize-sibling-calls -fno-common
Expand Down
34 changes: 22 additions & 12 deletions src/spindump_remote_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@
#include "spindump_event_parser_json.h"
#include "spindump_analyze.h"

//
// Datatypes ----------------------------------------------------------------------------------
//

#ifdef ENUMMHD
#define MHDRESULT enum MHD_Result
#else
#define MHDRESULT int
#endif

//
// Function prototypes ------------------------------------------------------------------------
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_answer(void *cls,
struct MHD_Connection *connection,
const char *url,
Expand All @@ -56,13 +66,13 @@ spindump_remote_server_getconnectionobject(struct spindump_remote_server* server
static void
spindump_remote_server_releaseconnectionobject(struct spindump_remote_server* server,
struct spindump_remote_connection* connection);
static enum MHD_Result
static MHDRESULT
spindump_remote_server_answer_error(struct MHD_Connection *connection,
unsigned int code,
char* why);
static void
spindump_remote_server_printparameters(struct MHD_Connection *connection);
static enum MHD_Result
static MHDRESULT
spindump_remote_server_printparameter(void *cls,
enum MHD_ValueKind kind,
const char *key,
Expand All @@ -72,11 +82,11 @@ spindump_remote_server_requestcompleted(void *cls,
struct MHD_Connection *connection,
void **con_cls,
enum MHD_RequestTerminationCode toe);
static enum MHD_Result
static MHDRESULT
spindump_remote_server_answertopost(struct spindump_remote_server* server,
struct spindump_remote_connection* connectionObject,
struct MHD_Connection *connection);
static enum MHD_Result
static MHDRESULT
spindump_remote_server_postiterator(void *coninfo_cls,
enum MHD_ValueKind kind,
const char *key,
Expand Down Expand Up @@ -321,7 +331,7 @@ spindump_remote_server_releaseconnectionobject(struct spindump_remote_server* se
// Provide a HTTP error as an answer
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_answer_error(struct MHD_Connection *connection,
unsigned int code,
char* why) {
Expand All @@ -330,7 +340,7 @@ spindump_remote_server_answer_error(struct MHD_Connection *connection,
struct MHD_Response *response = MHD_create_response_from_buffer (strlen(why),
(void*)why,
MHD_RESPMEM_PERSISTENT);
enum MHD_Result ret = MHD_queue_response(connection, code, response);
MHDRESULT ret = MHD_queue_response(connection, code, response);
MHD_destroy_response(response);
return(ret);
}
Expand All @@ -339,7 +349,7 @@ spindump_remote_server_answer_error(struct MHD_Connection *connection,
// Print a HTTP paremeter (for debugging purposes).
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_printparameter(void *cls,
enum MHD_ValueKind kind,
const char *key,
Expand All @@ -364,7 +374,7 @@ spindump_remote_server_printparameters(struct MHD_Connection *connection) {
// need to do here though.
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_postiterator(void *coninfo_cls,
enum MHD_ValueKind kind,
const char *key,
Expand All @@ -387,7 +397,7 @@ spindump_remote_server_postiterator(void *coninfo_cls,
// will give different answers.
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_answertopost(struct spindump_remote_server* server,
struct spindump_remote_connection* connectionObject,
struct MHD_Connection *connection) {
Expand Down Expand Up @@ -447,7 +457,7 @@ spindump_remote_server_answertopost(struct spindump_remote_server* server,
MHD_RESPMEM_PERSISTENT);
unsigned int code = MHD_HTTP_OK;
spindump_debugf("HTTP successful response %u", code);
enum MHD_Result ret = MHD_queue_response(connection, code, response);
MHDRESULT ret = MHD_queue_response(connection, code, response);
MHD_destroy_response(response);
connectionObject->ongoingTransaction = 0;
return(ret);
Expand Down Expand Up @@ -495,7 +505,7 @@ spindump_remote_server_adddata(struct spindump_remote_connection* connectionObje
// right path, right method, etc).
//

static enum MHD_Result
static MHDRESULT
spindump_remote_server_answer(void *cls,
struct MHD_Connection *connection,
const char *url,
Expand Down

0 comments on commit 0f17e09

Please sign in to comment.