Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jan 13, 2024
1 parent 8b71ce6 commit 0b4a807
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/posix_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ namespace aux {
// reading and writing, but doesn't create the file. "w+" creates
// the file and truncates it
#ifdef TORRENT_WINDOWS
f = ::_wfopen(convert_to_native_path_string(fn).c_str(), L"wb+");
f = ::_wfopen(convert_to_native_path_string(fn).c_str(), mode_str);
#else
f = std::fopen(fn.c_str(), "wb+");
f = std::fopen(fn.c_str(), mode_str);
#endif
if (f == nullptr)
{
Expand Down
6 changes: 4 additions & 2 deletions src/torrent_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ namespace libtorrent {
{
if (e1.port() > e2.port())
swap(e1, e2);
std::uint32_t p;
auto ptr = reinterpret_cast<char*>(&p);
std::array<char, 4> buf;
auto ptr = buf.data();
aux::write_uint16(e1.port(), ptr);
aux::write_uint16(e2.port(), ptr);
std::uint32_t p;
std::memcpy(&p, buf.data(), 4);
ret = crc32c_32(p);
}
else if (aux::is_v6(e1))
Expand Down

0 comments on commit 0b4a807

Please sign in to comment.