This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 961330b  Remove write-only variables
     new 674d1fc  Merge pull request #324 from jbapple/unused
961330b is described below

commit 961330b713f7fef222871e40572ca9e30f6dc09a
Author: Jim Apple <[email protected]>
AuthorDate: Sun Jan 8 19:39:18 2023 -0800

    Remove write-only variables
    
    These variables were never read, which causes warning when compiling
    with clang 16
---
 sampling/include/var_opt_sketch_impl.hpp | 4 ++--
 sampling/test/var_opt_sketch_test.cpp    | 2 --
 sampling/test/var_opt_union_test.cpp     | 2 --
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/sampling/include/var_opt_sketch_impl.hpp 
b/sampling/include/var_opt_sketch_impl.hpp
index 4bf8b22..2c8db2b 100644
--- a/sampling/include/var_opt_sketch_impl.hpp
+++ b/sampling/include/var_opt_sketch_impl.hpp
@@ -754,10 +754,10 @@ string<A> var_opt_sketch<T, A>::items_to_string(bool 
print_gap) const {
   const uint32_t array_length = (n_ < k_ ? n_ : k_ + 1);
   for (uint32_t i = 0, display_idx = 0; i < array_length; ++i) {
     if (i == h_ && print_gap) {
-      os << i << ": GAP" << std::endl;
+      os << display_idx << ": GAP" << std::endl;
       ++display_idx;
     } else {
-      os << i << ": " << data_[i] << "\twt = ";
+      os << display_idx << ": " << data_[i] << "\twt = ";
       if (weights_[i] == -1.0) {
         os << get_tau() << "\t(-1.0)" << std::endl;
       } else {
diff --git a/sampling/test/var_opt_sketch_test.cpp 
b/sampling/test/var_opt_sketch_test.cpp
index 8868dd9..b22f09f 100644
--- a/sampling/test/var_opt_sketch_test.cpp
+++ b/sampling/test/var_opt_sketch_test.cpp
@@ -55,14 +55,12 @@ static void check_if_equal(var_opt_sketch<T, A>& sk1, 
var_opt_sketch<T, A>& sk2)
       
   auto it1 = sk1.begin();
   auto it2 = sk2.begin();
-  size_t i = 0;
 
   while ((it1 != sk1.end()) && (it2 != sk2.end())) {
     auto p1 = *it1;
     auto p2 = *it2;
     REQUIRE(p1.first == p2.first);   // data values
     REQUIRE(p1.second == p2.second); // weights
-    ++i;
     ++it1;
     ++it2;
   }
diff --git a/sampling/test/var_opt_union_test.cpp 
b/sampling/test/var_opt_union_test.cpp
index 9b176c2..f478ff3 100644
--- a/sampling/test/var_opt_union_test.cpp
+++ b/sampling/test/var_opt_union_test.cpp
@@ -57,7 +57,6 @@ static void check_if_equal(var_opt_sketch<T, A>& sk1, 
var_opt_sketch<T, A>& sk2,
       
   auto it1 = sk1.begin();
   auto it2 = sk2.begin();
-  size_t i = 0;
 
   while ((it1 != sk1.end()) && (it2 != sk2.end())) {
     const std::pair<const T&, const double> p1 = *it1;
@@ -66,7 +65,6 @@ static void check_if_equal(var_opt_sketch<T, A>& sk1, 
var_opt_sketch<T, A>& sk2,
       REQUIRE(p1.first == p2.first); // data values
     }
     REQUIRE(p1.second == p2.second); // weight values
-    ++i;
     ++it1;
     ++it2;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to