use c++-stype casts + compare the same types
This commit is contained in:
parent
65e98c1940
commit
9406eb4c44
1 changed files with 3 additions and 2 deletions
|
@ -39,10 +39,11 @@ image_dimensions<max_size>::image_dimensions(int width, int height)
|
|||
: width_(width),
|
||||
height_(height)
|
||||
{
|
||||
int64_t area = (int64_t)width * (int64_t)height;
|
||||
std::int64_t area = static_cast<std::int64_t>(width) * static_cast<std::int64_t>(height);
|
||||
if (width < 0) throw std::runtime_error("Invalid width for image dimensions requested");
|
||||
if (height < 0) throw std::runtime_error("Invalid height for image dimensions requested");
|
||||
if (area > max_size) throw std::runtime_error("Image area too large based on image dimensions");
|
||||
if (area > static_cast<std::int64_t>(max_size))
|
||||
throw std::runtime_error("Image area too large based on image dimensions");
|
||||
}
|
||||
|
||||
template <std::size_t max_size>
|
||||
|
|
Loading…
Reference in a new issue