From 830b1011d12871251e32ca27175fa0682e7d2244 Mon Sep 17 00:00:00 2001 From: Karl Semich <0xloem@gmail.com> Date: Thu, 22 Oct 2020 09:21:01 -0400 Subject: [PATCH 1/2] resolve noop comparison warning --- src/zmq/certificate.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/zmq/certificate.cpp b/src/zmq/certificate.cpp index 4de25a13..23cfae1e 100644 --- a/src/zmq/certificate.cpp +++ b/src/zmq/certificate.cpp @@ -79,7 +79,7 @@ bool certificate::create(config::sodium& out_public, { // Loop until neither key's base85 encoding includes the # character. // This ensures that the value can be used in libbitcoin settings files. - for (uint8_t attempt = 0; attempt <= max_uint8; attempt++) + while (true) { char public_key[zmq_encoded_key_size + 1] = { 0 }; char private_key[zmq_encoded_key_size + 1] = { 0 }; @@ -95,8 +95,6 @@ bool certificate::create(config::sodium& out_public, return out_public; } } - - return false; } certificate::operator bool() const From ca5947bcaadefdd7797b45879311e7665295544e Mon Sep 17 00:00:00 2001 From: Karl Semich <0xloem@gmail.com> Date: Fri, 23 Oct 2020 18:26:11 -0400 Subject: [PATCH 2/2] Change to bounded behavior per PR suggestions --- src/zmq/certificate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/zmq/certificate.cpp b/src/zmq/certificate.cpp index 23cfae1e..28f98a7b 100644 --- a/src/zmq/certificate.cpp +++ b/src/zmq/certificate.cpp @@ -79,7 +79,7 @@ bool certificate::create(config::sodium& out_public, { // Loop until neither key's base85 encoding includes the # character. // This ensures that the value can be used in libbitcoin settings files. - while (true) + for (uint8_t attempt = 0; attempt < max_uint8; attempt++) { char public_key[zmq_encoded_key_size + 1] = { 0 }; char private_key[zmq_encoded_key_size + 1] = { 0 }; @@ -95,6 +95,8 @@ bool certificate::create(config::sodium& out_public, return out_public; } } + + return false; } certificate::operator bool() const