From 8bb7043d51bc89230a2f40d53219657b8b2766b1 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Viel Date: Sun, 10 May 2020 19:41:36 +0200 Subject: [PATCH 1/2] Clean: Make it clear we cast -1 to unsigned on purpose Thus this will most likely make the code crash when this value will be used as a container index. --- src/cpp/flann/util/lsh_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/flann/util/lsh_table.h b/src/cpp/flann/util/lsh_table.h index 58c644ec..f97b897b 100644 --- a/src/cpp/flann/util/lsh_table.h +++ b/src/cpp/flann/util/lsh_table.h @@ -235,7 +235,7 @@ class LshTable size_t getKey(const ElementType* /*feature*/) const { std::cerr << "LSH is not implemented for that type" << std::endl; - return -1; + return static_cast(-1); } /** Get statistics about the table From 0db4c2191bbe39ab6c00f0d3f30da35711a25d3f Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Viel Date: Thu, 2 Jul 2020 00:14:04 +0200 Subject: [PATCH 2/2] Make the returned value for errors consistent with final choice in OpenCV version --- src/cpp/flann/util/lsh_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/flann/util/lsh_table.h b/src/cpp/flann/util/lsh_table.h index f97b897b..6f61ecd6 100644 --- a/src/cpp/flann/util/lsh_table.h +++ b/src/cpp/flann/util/lsh_table.h @@ -235,7 +235,7 @@ class LshTable size_t getKey(const ElementType* /*feature*/) const { std::cerr << "LSH is not implemented for that type" << std::endl; - return static_cast(-1); + return 0; } /** Get statistics about the table