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

Fixed most of warnings in examples and some in core library #545

Merged
merged 3 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/hessian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ gil::gray8_image_t to_grayscale(gil::rgb8_view_t original)

void apply_gaussian_blur(gil::gray8_view_t input_view, gil::gray8_view_t output_view)
{
constexpr static auto filter_height = 5ull;
constexpr static auto filter_width = 5ull;
constexpr static std::ptrdiff_t filter_height = 5ull;
constexpr static std::ptrdiff_t filter_width = 5ull;
constexpr static double filter[filter_height][filter_width] =
{
{ 2, 4, 6, 4, 2 },
Expand Down
2 changes: 1 addition & 1 deletion example/mandelbrot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct mandelbrot_fn
t=pow(t,0.2);

value_type ret;
for (int k=0; k<num_channels<P>::value; ++k)
for (std::size_t k=0; k<num_channels<P>::value; ++k)
ret[k]=(typename channel_type<P>::type)(_in_color[k]*t + _out_color[k]*(1-t));
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/channel_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct unsigned_integral_max_value<packed_channel_value<K>>

template <typename UnsignedIntegralChannel>
struct unsigned_integral_num_bits
: std::integral_constant<int, sizeof(UnsignedIntegralChannel) * 8>
: std::integral_constant<int, static_cast<int>(sizeof(UnsignedIntegralChannel) * 8)>
{};

template <int K>
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/color_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct homogeneous_color_base<Element, Layout, 1>
typename U = Element,
typename = typename std::enable_if<!std::is_reference<U>::value>::type
>
homogeneous_color_base() : v0_{} {};
homogeneous_color_base() : v0_{} {}

explicit homogeneous_color_base(Element v) : v0_(v) {}

Expand Down
8 changes: 4 additions & 4 deletions include/boost/gil/color_convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ struct default_color_converter_impl<rgb_t, cmyk_t>
// Apply color correction, strengthening, reducing non-zero components by
// s = 1 / (1 - k) for k < 1, where 1 denotes dst_t max, otherwise s = 1 (literal).
uint_t const dst_max = channel_traits<uint_t>::max_value();
uint_t const s_div = dst_max - k;
uint_t const s_div = static_cast<uint_t>(dst_max - k);
if (s_div != 0)
{
double const s = dst_max / static_cast<double>(s_div);
c = (c - k) * s;
m = (m - k) * s;
y = (y - k) * s;
c = static_cast<uint_t>((c - k) * s);
m = static_cast<uint_t>((m - k) * s);
y = static_cast<uint_t>((y - k) * s);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/image_processing/harris.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void compute_harris_responses(
" tensor from the same image");
}

auto const window_length = weights.size();
std::ptrdiff_t const window_length = weights.size();
auto const width = m11.width();
auto const height = m11.height();
auto const half_length = window_length / 2;
Expand Down
4 changes: 2 additions & 2 deletions include/boost/gil/image_processing/hessian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ inline void compute_hessian_responses(
auto ddxx_i = channel_t();
auto ddyy_i = channel_t();
auto dxdy_i = channel_t();
for (typename OutputView::coord_t w_y = 0; w_y < weights.size(); ++w_y)
for (typename OutputView::coord_t w_y = 0; w_y < static_cast<std::ptrdiff_t>(weights.size()); ++w_y)
{
for (typename OutputView::coord_t w_x = 0; w_x < weights.size(); ++w_x)
for (typename OutputView::coord_t w_x = 0; w_x < static_cast<std::ptrdiff_t>(weights.size()); ++w_x)
{
ddxx_i += ddxx(x + w_x - center, y + w_y - center)
.at(std::integral_constant<int, 0>{}) * weights.at(w_x, w_y);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/image_processing/numeric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline double lanczos(double x, std::ptrdiff_t a)
if (0 <= x && x <= 0)
return 1;

if (-a < x && x < a)
if (static_cast<double>(-a) < x && x < static_cast<double>(a))
return normalized_sinc(x) / normalized_sinc(x / static_cast<double>(a));

return 0;
Expand Down