yhirose/cpp-httplib

MSVC warning C4100: 'content_length': unreferenced formal parameter

bobbymcr opened this issue · 1 comments

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.

Fixed by #1838