浏览代码

Merge pull request #418 from pulsa/master

Allow compiling as C++.
bel2125 8 年之前
父节点
当前提交
e15c4ef4e7
共有 2 个文件被更改,包括 7 次插入6 次删除
  1. 4 3
      src/civetweb.c
  2. 3 3
      src/handle_form.inl

+ 4 - 3
src/civetweb.c

@@ -8565,7 +8565,7 @@ prepare_cgi_environment(struct mg_connection *conn,
 			addenv(env, "SCRIPT_NAME=%s", conn->request_info.local_uri);
 			addenv(env, "SCRIPT_NAME=%s", conn->request_info.local_uri);
 		} else {
 		} else {
 			/* URI: /path_to_script/ ... using index.cgi */
 			/* URI: /path_to_script/ ... using index.cgi */
-			char *index_file = strrchr(prog, '/');
+			const char *index_file = strrchr(prog, '/');
 			if (index_file) {
 			if (index_file) {
 				addenv(env,
 				addenv(env,
 				       "SCRIPT_NAME=%s%s",
 				       "SCRIPT_NAME=%s%s",
@@ -13195,7 +13195,8 @@ static int
 get_uri_type(const char *uri)
 get_uri_type(const char *uri)
 {
 {
 	int i;
 	int i;
-	char *hostend, *portbegin, *portend;
+	const char *hostend, *portbegin;
+	char *portend;
 	unsigned long port;
 	unsigned long port;
 
 
 	/* According to the HTTP standard
 	/* According to the HTTP standard
@@ -14904,7 +14905,7 @@ mg_start(const struct mg_callbacks *callbacks,
 
 
 	/* Start worker threads */
 	/* Start worker threads */
 	for (i = 0; i < ctx->cfg_worker_threads; i++) {
 	for (i = 0; i < ctx->cfg_worker_threads; i++) {
-		struct worker_thread_args *wta =
+		struct worker_thread_args *wta = (struct worker_thread_args *)
 		    mg_malloc(sizeof(struct worker_thread_args));
 		    mg_malloc(sizeof(struct worker_thread_args));
 		if (wta) {
 		if (wta) {
 			wta->ctx = ctx;
 			wta->ctx = ctx;

+ 3 - 3
src/handle_form.inl

@@ -90,7 +90,7 @@ url_encoded_field_get(const struct mg_connection *conn,
 {
 {
 	char key_dec[1024];
 	char key_dec[1024];
 
 
-	char *value_dec = mg_malloc(value_len + 1);
+	char *value_dec = (char*)mg_malloc(value_len + 1);
 	int value_dec_len, ret;
 	int value_dec_len, ret;
 
 
 	if (!value_dec) {
 	if (!value_dec) {
@@ -521,8 +521,8 @@ mg_handle_form_request(struct mg_connection *conn,
 		size_t bl;
 		size_t bl;
 		ptrdiff_t used;
 		ptrdiff_t used;
 		struct mg_request_info part_header;
 		struct mg_request_info part_header;
-		char *hbuf, *hend, *fbeg, *fend, *nbeg, *nend;
-		const char *content_disp;
+		char *hbuf;
+		const char *content_disp, *hend, *fbeg, *fend, *nbeg, *nend;
 		const char *next;
 		const char *next;
 
 
 		memset(&part_header, 0, sizeof(part_header));
 		memset(&part_header, 0, sizeof(part_header));