From 7fd253f895c4d14788b5e7d8314a7b309e33429c Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 8 Sep 2018 19:48:11 +0200 Subject: [PATCH] Read directly from the vector's buffer --- io/passwordfile.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/io/passwordfile.cpp b/io/passwordfile.cpp index 0ad0988..3c76493 100644 --- a/io/passwordfile.cpp +++ b/io/passwordfile.cpp @@ -281,9 +281,7 @@ void PasswordFile::load() // parse contents stringstream decryptedStream(stringstream::in | stringstream::out | stringstream::binary); - decryptedStream.write(decryptedData.data(), static_cast(remainingSize)); - decryptedData.resize(0); - decryptedStream.seekg(0, ios_base::beg); + decryptedStream.rdbuf()->pubsetbuf(decryptedData.data(), static_cast(remainingSize)); if (version >= 0x5u) { const auto extendedHeaderSize = m_freader.readUInt16BE(); m_encryptedExtendedHeader = m_freader.readString(extendedHeaderSize);