diff options
Diffstat (limited to 'src/examples/websocket_chatserver_example.c')
-rw-r--r-- | src/examples/websocket_chatserver_example.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/examples/websocket_chatserver_example.c b/src/examples/websocket_chatserver_example.c index cd5940db..f01ada43 100644 --- a/src/examples/websocket_chatserver_example.c +++ b/src/examples/websocket_chatserver_example.c | |||
@@ -966,12 +966,9 @@ chat_adduser (struct ConnectedUser *cu) | |||
966 | 966 | ||
967 | /* add the new user to the list */ | 967 | /* add the new user to the list */ |
968 | size_t user_count_ = user_count + 1; | 968 | size_t user_count_ = user_count + 1; |
969 | struct ConnectedUser **users_ = (struct ConnectedUser **) realloc (users, | 969 | struct ConnectedUser **users_ = |
970 | user_count_ | 970 | (struct ConnectedUser **) realloc (users, user_count_ |
971 | * sizeof ( | 971 | * sizeof (struct ConnectedUser *)); |
972 | struct | ||
973 | ConnectedUser | ||
974 | *)); | ||
975 | if (NULL == users_) | 972 | if (NULL == users_) |
976 | { | 973 | { |
977 | /* realloc failed */ | 974 | /* realloc failed */ |
@@ -1546,8 +1543,8 @@ connecteduser_parse_received_websocket_stream (struct ConnectedUser *cu, | |||
1546 | snprintf (result_text + 5, 235, "%d", (int) cu->user_id); | 1543 | snprintf (result_text + 5, 235, "%d", (int) cu->user_id); |
1547 | strcat (result_text, | 1544 | strcat (result_text, |
1548 | "|"); | 1545 | "|"); |
1549 | snprintf (result_text + strlen (result_text), 240 - strlen ( | 1546 | snprintf (result_text + strlen (result_text), 240 |
1550 | result_text), "%d", (int) ping); | 1547 | - strlen (result_text), "%d", (int) ping); |
1551 | chat_addmessage (0, | 1548 | chat_addmessage (0, |
1552 | 0, | 1549 | 0, |
1553 | result_text, | 1550 | result_text, |
@@ -2256,9 +2253,10 @@ access_handler (void *cls, | |||
2256 | { | 2253 | { |
2257 | /* return error page */ | 2254 | /* return error page */ |
2258 | struct MHD_Response *response; | 2255 | struct MHD_Response *response; |
2259 | response = MHD_create_response_from_buffer_static (strlen ( | 2256 | response = |
2260 | PAGE_INVALID_WEBSOCKET_REQUEST), | 2257 | MHD_create_response_from_buffer_static ( \ |
2261 | PAGE_INVALID_WEBSOCKET_REQUEST); | 2258 | strlen (PAGE_INVALID_WEBSOCKET_REQUEST), |
2259 | PAGE_INVALID_WEBSOCKET_REQUEST); | ||
2262 | ret = MHD_queue_response (connection, | 2260 | ret = MHD_queue_response (connection, |
2263 | MHD_HTTP_BAD_REQUEST, | 2261 | MHD_HTTP_BAD_REQUEST, |
2264 | response); | 2262 | response); |