Improve condition for use of `pubsetbuf`

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++`.
This commit is contained in:
Martchus 2023-02-28 21:01:23 +01:00
parent 7bb9134fd3
commit 92d8324cdc
1 changed files with 3 additions and 3 deletions

View File

@ -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);