Don't use pubsetbuf() when using libc++
Otherwise the eof bit is set on attempt to read
This commit is contained in:
parent
60d8972dcb
commit
ff76846e8b
|
@ -44,7 +44,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||||
set(META_APP_DESCRIPTION "C++ library to read/write passwords from/to encrypted files")
|
set(META_APP_DESCRIPTION "C++ library to read/write passwords from/to encrypted files")
|
||||||
set(META_VERSION_MAJOR 3)
|
set(META_VERSION_MAJOR 3)
|
||||||
set(META_VERSION_MINOR 2)
|
set(META_VERSION_MINOR 2)
|
||||||
set(META_VERSION_PATCH 0)
|
set(META_VERSION_PATCH 1)
|
||||||
set(META_PUBLIC_SHARED_LIB_DEPENDS c++utilities)
|
set(META_PUBLIC_SHARED_LIB_DEPENDS c++utilities)
|
||||||
set(META_PUBLIC_STATIC_LIB_DEPENDS c++utilities_static)
|
set(META_PUBLIC_STATIC_LIB_DEPENDS c++utilities_static)
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,11 @@ void PasswordFile::load()
|
||||||
stringstream decryptedStream(stringstream::in | stringstream::out | stringstream::binary);
|
stringstream decryptedStream(stringstream::in | stringstream::out | stringstream::binary);
|
||||||
decryptedStream.exceptions(ios_base::failbit | ios_base::badbit);
|
decryptedStream.exceptions(ios_base::failbit | ios_base::badbit);
|
||||||
try {
|
try {
|
||||||
|
#ifdef _LIBCPP_VERSION
|
||||||
|
decryptedStream.write(decryptedData.data(), static_cast<streamsize>(remainingSize));
|
||||||
|
#else
|
||||||
decryptedStream.rdbuf()->pubsetbuf(decryptedData.data(), static_cast<streamsize>(remainingSize));
|
decryptedStream.rdbuf()->pubsetbuf(decryptedData.data(), static_cast<streamsize>(remainingSize));
|
||||||
|
#endif
|
||||||
if (version >= 0x5u) {
|
if (version >= 0x5u) {
|
||||||
const auto extendedHeaderSize = m_freader.readUInt16BE();
|
const auto extendedHeaderSize = m_freader.readUInt16BE();
|
||||||
m_encryptedExtendedHeader = m_freader.readString(extendedHeaderSize);
|
m_encryptedExtendedHeader = m_freader.readString(extendedHeaderSize);
|
||||||
|
|
Loading…
Reference in New Issue