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

MSVC warning C4100: 'content_length': unreferenced formal parameter #1837

Closed
bobbymcr opened this issue May 15, 2024 · 1 comment
Closed

Comments

@bobbymcr
Copy link

I'm seeing this warning when building with MSVC using warning level 4 (/W4):

httplib.h(4787,45): warning C4100: 'content_length': unreferenced formal parameter

I am using the 0.15.3 release from vcpkg; in that version, the warning is referring to this function:

inline std::pair<size_t, size_t>
get_range_offset_and_length(Range r, size_t content_length) {
  assert(r.first != -1 && r.second != -1);
  assert(0 <= r.first && r.first < static_cast<ssize_t>(content_length));
  assert(r.first <= r.second &&
         r.second < static_cast<ssize_t>(content_length));

  return std::make_pair(r.first, static_cast<size_t>(r.second - r.first) + 1);
}

I assume the warning is due to the fact that the only code referencing the content_length value is inside an assert.

@yhirose
Copy link
Owner

yhirose commented May 17, 2024

Fixed by #1838

@yhirose yhirose closed this as completed May 17, 2024
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

No branches or pull requests

2 participants