Skip to content

Commit 0f99bc6

Browse files
committed
Fixing issues flagged by Coverity
1 parent d1d472a commit 0f99bc6

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

include/mdcomp/bigendian_io.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ namespace detail {
232232
uint_t byte2 = new_value & mask2;
233233
new_value = static_cast<uint_t>(
234234
new_value ^ byte1 ^ byte2 ^ (byte1 << diff) ^ (byte2 >> diff));
235-
mask1 = static_cast<uint_t>(mask1 << nbits);
236-
mask2 = static_cast<uint_t>(mask2 >> nbits);
235+
mask1 = std::rotl(mask1, nbits);
236+
mask2 = std::rotr(mask2, nbits);
237237
diff -= 2ULL * nbits;
238238
}
239239
return uint_t(new_value & std::numeric_limits<uint_t>::max());

include/mdcomp/options_lib.hh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
#include <getopt.h>
2222

23-
#include <boost/io/ios_state.hpp>
24-
#include <boost/io_fwd.hpp>
25-
2623
#include <array>
2724
#include <charconv>
2825
#include <concepts> // IWYU pragma: keep
@@ -325,9 +322,8 @@ namespace detail {
325322

326323
template <typename instream, typename outstream, typename options_t>
327324
inline void do_decode(instream& input, outstream& output, options_t const& options) {
328-
auto const do_print_end = [&]() noexcept {
325+
auto const do_print_end = [&]() {
329326
if constexpr (has_print_end<options_t>) {
330-
boost::io::ios_all_saver const flags(std::cout);
331327
std::cout << std::format("0x{:06x}", static_cast<size_t>(input.tellg()));
332328
}
333329
};

src/lib/nemesis.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ class nemesis_internal {
910910
next_coins.push(make_shared<node>(child0, child1));
911911
}
912912
index++;
913-
current_coins = next_coins;
913+
current_coins = std::move(next_coins);
914914
}
915915

916916
// The Coin Collector's problem has been solved. Now it is time to
@@ -1016,7 +1016,7 @@ class nemesis_internal {
10161016
// Is this iteration better than the best?
10171017
if (temp_size_est < size_est) {
10181018
// If yes, save the code_map and file size.
1019-
code_map = temp_code_map;
1019+
code_map = std::move(temp_code_map);
10201020
size_est = temp_size_est;
10211021
}
10221022
}

0 commit comments

Comments
 (0)