Skip to content

Commit

Permalink
Avoid having multiple declarations in a single statement for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
kimci86 committed Feb 25, 2024
1 parent e06e573 commit 4beae79
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion include/Keys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class Keys
}

private:
std::uint32_t x = 0x12345678, y = 0x23456789, z = 0x34567890;
std::uint32_t x = 0x12345678;
std::uint32_t y = 0x23456789;
std::uint32_t z = 0x34567890;
};

#endif // BKCRACK_KEYS_HPP
3 changes: 2 additions & 1 deletion src/Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ struct Range
return size() < other.size();
}

std::vector<std::pair<std::size_t, std::uint8_t>>::iterator begin, end;
std::vector<std::pair<std::size_t, std::uint8_t>>::iterator begin;
std::vector<std::pair<std::size_t, std::uint8_t>>::iterator end;
};

} // namespace
Expand Down
6 changes: 4 additions & 2 deletions src/Zip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ std::istream& Zip::seek(const Entry& entry) const
throw Error("could not find local file header");

// skip local file header
std::uint16_t nameSize, extraSize;
std::uint16_t nameSize;
std::uint16_t extraSize;
m_is.seekg(22, std::ios::cur);
read(m_is, nameSize);
read(m_is, extraSize);
Expand Down Expand Up @@ -361,7 +362,8 @@ void Zip::changeKeys(std::ostream& os, const Keys& oldKeys, const Keys& newKeys,
std::copy_n(std::istreambuf_iterator<char>(m_is), 22, std::ostreambuf_iterator<char>(os));
m_is.get();

std::uint16_t filenameLength, extraSize;
std::uint16_t filenameLength;
std::uint16_t extraSize;
read(m_is, filenameLength);
read(m_is, extraSize);
write(os, filenameLength);
Expand Down
3 changes: 2 additions & 1 deletion src/Zreduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void Zreduction::reduce(Progress& progress)
constexpr std::size_t trackSizeThreshold = 1 << 16;
bool tracking = false;
std::vector<std::uint32_t> bestCopy;
std::size_t bestIndex = index, bestSize = trackSizeThreshold;
std::size_t bestIndex = index;
std::size_t bestSize = trackSizeThreshold;

// variables to wait for a limited number of steps when a small enough vector is found
constexpr std::size_t waitSizeThreshold = 1 << 8;
Expand Down

0 comments on commit 4beae79

Please sign in to comment.