Skip to content

Commit

Permalink
Improve condition for use of pubsetbuf
Browse files Browse the repository at this point in the history
Using this function like this seems only be possible with `libstdc++`. The
standard lib of MSVC does not support it as well. So use it only with
`libstdc++`.
  • Loading branch information
Martchus committed Feb 28, 2023
1 parent 7bb9134 commit 92d8324
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions io/passwordfile.cpp
Expand Up @@ -349,10 +349,10 @@ void PasswordFile::load()
stringstream decryptedStream(stringstream::in | stringstream::out | stringstream::binary);
decryptedStream.exceptions(ios_base::failbit | ios_base::badbit);
try {
#ifdef _LIBCPP_VERSION
decryptedStream.write(decryptedData.data(), static_cast<streamsize>(remainingSize));
#else
#if defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION)
decryptedStream.rdbuf()->pubsetbuf(decryptedData.data(), static_cast<streamsize>(remainingSize));
#else
decryptedStream.write(decryptedData.data(), static_cast<streamsize>(remainingSize));
#endif
if (m_version >= 0x5u) {
BinaryReader reader(&decryptedStream);
Expand Down

0 comments on commit 92d8324

Please sign in to comment.