Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Fix: suppress warning C4244 on MSVC #296

Closed
wants to merge 1 commit into from
Closed

Fix: suppress warning C4244 on MSVC #296

wants to merge 1 commit into from

Conversation

bc-lee
Copy link

@bc-lee bc-lee commented Mar 29, 2016

MSVC 2015 gives some warnings on http_parser.c with

warning C4244: '=' : conversion from 'int' to 'uint16_t', possible loss of data
It will supress this warning.

@indutny
Copy link
Member

indutny commented Mar 29, 2016

@bc-lee which line produces this warning?

@bc-lee
Copy link
Author

bc-lee commented Mar 29, 2016

@indutny In line 2273, 2280, 2292, 2301 (conversion from 'int' to 'uint16_t')

u->field_data[UF_HOST].off = p - buf;

and, in line 1415, 1520, 1689 (conversion from '__int64' to 'uint32_t') which occurs only if using 64bit MSVC.

COUNT_HEADER_SIZE(p - start);

@indutny
Copy link
Member

indutny commented Mar 29, 2016

Thank you for prompt reply! May I ask you if you have any particular reason to fix these warnings? Or if this PR is intended to remove them just for the sake of clean compiler output?

cc @mscdex @jasnell

@craig65535
Copy link

IMO fixing the code is preferable to suppressing the warning. It's possible that all you need is to cast to uint16_t.

@jasnell
Copy link
Member

jasnell commented Mar 30, 2016

I'm fine with the change, I do agree that we may need to refactor this bit of the code for a bit to avoid the issue in the first place.

@misery
Copy link
Contributor

misery commented Jan 12, 2018

@bc-lee bc-lee closed this Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants