Browse Source

Change mg_set_user_connection_data() to take a non-const connection since the connection needs to be modified. This fixes a "drops const qualifier" warning on OS X.

Kevin Wojniak 9 năm trước cách đây
mục cha
commit
61daaa08dc
2 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 1 1
      include/civetweb.h
  2. 2 2
      src/civetweb.c

+ 1 - 1
include/civetweb.h

@@ -389,7 +389,7 @@ CIVETWEB_API void *mg_get_user_data(const struct mg_context *ctx);
 
 
 /* Set user data for the current connection. */
-CIVETWEB_API void mg_set_user_connection_data(const struct mg_connection *conn,
+CIVETWEB_API void mg_set_user_connection_data(struct mg_connection *conn,
                                               void *data);
 
 

+ 2 - 2
src/civetweb.c

@@ -1739,10 +1739,10 @@ mg_get_user_data(const struct mg_context *ctx)
 
 
 void
-mg_set_user_connection_data(const struct mg_connection *conn, void *data)
+mg_set_user_connection_data(struct mg_connection *conn, void *data)
 {
 	if (conn != NULL) {
-		((struct mg_connection *)conn)->request_info.conn_data = data;
+		conn->request_info.conn_data = data;
 	}
 }