From 47651766fb057ee3f7f090615793a1eb78b1b0b0 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sun, 30 Sep 2012 16:35:09 +0100 Subject: [PATCH 1/2] Squashed warning under linux --- mongoose.c | 4 ++-- mongoose.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index df264193..9e90ba45 100644 --- a/mongoose.c +++ b/mongoose.c @@ -526,7 +526,7 @@ static int is_file_in_memory(struct mg_connection *conn, const char *path, struct file *filep) { conn->request_info.ev_data = (void *) path; if ((filep->membuf = call_user(conn, MG_OPEN_FILE)) != NULL) { - filep->size = (int) conn->request_info.ev_data; + filep->size = (int) (long) conn->request_info.ev_data; } return filep->membuf != NULL; } @@ -922,7 +922,7 @@ static void send_http_error(struct mg_connection *conn, int status, int len; conn->status_code = status; - conn->request_info.ev_data = (void *) status; + conn->request_info.ev_data = (void *) (long) status; if (call_user(conn, MG_HTTP_ERROR) == NULL) { buf[0] = '\0'; len = 0; diff --git a/mongoose.h b/mongoose.h index c46c7226..718413ed 100644 --- a/mongoose.h +++ b/mongoose.h @@ -67,7 +67,7 @@ enum mg_event { // HTTP error must be returned to the client. // If callback returns non-NULL, Mongoose stops handling error. // ev_data contains HTTP error code: - // int http_reply_status_code = (int) request_info->ev_data; + // int http_reply_status_code = (long) request_info->ev_data; MG_HTTP_ERROR, // Mongoose logs a message. From 365b5e8f8ad2d86e0e64dbcfe75d4655e9258306 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 1 Oct 2012 10:19:20 +0100 Subject: [PATCH 2/2] Using long for file size in MG_OPEN_FILE ev_data --- mongoose.c | 2 +- mongoose.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index 9e90ba45..e5fce540 100644 --- a/mongoose.c +++ b/mongoose.c @@ -526,7 +526,7 @@ static int is_file_in_memory(struct mg_connection *conn, const char *path, struct file *filep) { conn->request_info.ev_data = (void *) path; if ((filep->membuf = call_user(conn, MG_OPEN_FILE)) != NULL) { - filep->size = (int) (long) conn->request_info.ev_data; + filep->size = (long) conn->request_info.ev_data; } return filep->membuf != NULL; } diff --git a/mongoose.h b/mongoose.h index 718413ed..7c409afa 100644 --- a/mongoose.h +++ b/mongoose.h @@ -87,11 +87,11 @@ enum mg_event { // will use the returned value as a pointer to the file data. This allows // for example to serve files from memory. // ev_data contains file path, including document root path. - // Upon return, ev_data should return file size, which should be an int. + // Upon return, ev_data should return file size, which should be a long int. // // const char *file_name = request_info->ev_data; // if (strcmp(file_name, "foo.txt") == 0) { - // request_info->ev_data = (void *) (int) 4; + // request_info->ev_data = (void *) (long) 4; // return "data"; // } // return NULL;