From 6a08b444334ee422fd1b195ee4d26719129b1579 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 5 Dec 2016 11:56:12 +0100 Subject: [PATCH] Png: avoid multiplication at int precision, then converting to long Change-Id: Id05d1db07ae7e8978b2a6b989b6366ae66d0e9de --- .clang-tidy | 2 +- common/Png.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index eaef0e5123..9853876b58 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,3 @@ -Checks: 'clang-diagnostic-*,performance-*,unused-*,misc-*,-misc-macro-parentheses,readability-redundant-*' +Checks: 'clang-diagnostic-*,performance-*,unused-*,misc-*,-misc-macro-parentheses,readability-redundant-*,-readability-redundant-declaration' WarningsAsErrors: '*' diff --git a/common/Png.hpp b/common/Png.hpp index b4ff059e44..3e2b473585 100644 --- a/common/Png.hpp +++ b/common/Png.hpp @@ -160,14 +160,14 @@ bool encodeBufferToPNG(unsigned char* pixmap, int width, int height, } inline -uint64_t hashBuffer(unsigned char* pixmap, int width, int height) +uint64_t hashBuffer(unsigned char* pixmap, long width, long height) { return SpookyHash::Hash64(pixmap, width * height * 4, 1073741789); } inline uint64_t hashSubBuffer(unsigned char* pixmap, size_t startX, size_t startY, - int width, int height, int bufferWidth, int bufferHeight) + long width, long height, int bufferWidth, int bufferHeight) { if (bufferWidth < width || bufferHeight < height) return 0; // magic invalid hash.