jpbarrette / curlpp

C++ wrapper around libcURL
http://www.curlpp.org
1.68k stars 360 forks source link

put down sign-conversion warning #165

Closed d-fal closed 11 months ago

d-fal commented 11 months ago

When compiling as a part of the project, I see this unattended type conversion:

$PROJECT_ROOT/build/_deps/curlpp-src/src/curlpp/internal/OptionSetter.cpp: In static member function ‘static size_t curlpp::internal::Callbacks::StreamReadCallback(char*, size_t, size_t, std::istream*)’:
$PROJECT_ROOT/build/_deps/curlpp-src/src/curlpp/internal/OptionSetter.cpp:78:49: error: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘std::streamsize’ {aka ‘long int’} may change the sign of the result [-Werror=sign-conversion]
   78 |                 size_t realread = stream->gcount();

To remedy this, I would suggest to static_cast the gcount() result into the very size_t.