Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about size_t being cast to a narrower type #1875

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

obones
Copy link
Contributor

@obones obones commented Nov 16, 2021

This fixes a few C4267 warning as reported in #1866 because the x64 target defines size_t as a 64 bit unsigned integer.

@@ -63,7 +63,7 @@ static void gpsd_client_event(struct mg_connection *nc, int ev, void *ev_data)
// Success
fprintf(stderr, "GPSd Connected...\n");
if (ctx->init_str && *ctx->init_str) {
mg_send(nc, ctx->init_str, strlen(ctx->init_str));
mg_send(nc, ctx->init_str, (int)strlen(ctx->init_str));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not be required if mongoose was consistent in its methods declarations: mg_send_http_chunk, mg_send_websocket_frame and almost all others take a size_t, but for some reason mg_send does not...

@@ -1090,7 +1090,7 @@ static void http_broadcast_send(struct http_server_context *ctx, char const *msg
mg_set_timer(nc, mg_time() + KEEP_ALIVE); // reset keep alive timer
}
else if (cctx && !cctx->is_chunked) {
mg_send(nc, msg, len);
mg_send(nc, msg, (int)len);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not be required if mongoose was consistent in its methods declarations: mg_send_http_chunk, mg_send_websocket_frame and almost all others take a size_t, but for some reason mg_send does not...

@obones
Copy link
Contributor Author

obones commented Jan 9, 2023

I have just rebased this branch on the latest master, please let me know if this is still of interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant