From 737487c8504d67d5eec3d9015d4c24a35dbc79ec Mon Sep 17 00:00:00 2001 From: Geoffrey Daniels Date: Tue, 3 Oct 2023 20:16:29 +0100 Subject: [PATCH] Fixing some type conversion warnings. --- source/crypto/chacha | 4 ++-- source/game/mastermind | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/crypto/chacha b/source/crypto/chacha index 4a09e13..4201f08 100644 --- a/source/crypto/chacha +++ b/source/crypto/chacha @@ -231,7 +231,7 @@ namespace gtl { const block_type block = chacha::transform_block(key, initialisation_vector); result = chacha::xor_data(block, data);; ++counter; - for (int i = 0; i < 4; ++i) { + for (unsigned int i = 0; i < 4; ++i) { initialisation_vector.data[i] = unpack_byte(counter, i); } } @@ -240,7 +240,7 @@ namespace gtl { const block_type block = chacha::transform_block(key, initialisation_vector); result = chacha::xor_data(block, data);; ++counter; - for (int i = 0; i < 8; ++i) { + for (unsigned int i = 0; i < 8; ++i) { initialisation_vector.data[i] = unpack_byte(counter, i); } } diff --git a/source/game/mastermind b/source/game/mastermind index 6d843ee..8b83497 100644 --- a/source/game/mastermind +++ b/source/game/mastermind @@ -138,7 +138,7 @@ namespace gtl { } // Select the minimum of the maximums to get the best guess. std::vector::iterator min_element = std::min_element(scores.begin(), scores.end()); - guess = unguessed_codes[std::distance(scores.begin(), min_element)]; + guess = unguessed_codes[static_cast(std::distance(scores.begin(), min_element))]; // Check to see if there is a possible code with the same score, if so, prefer that. const unsigned int min_score = *min_element; for (unsigned int i = 0; i < unguessed_codes.size(); ++i) {