-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport bug fixes into the msix-sdk repo #420
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ namespace MSIX { | |
{ | ||
ThrowErrorIfNot(Error::InflateRead,(self->m_compressionObject->GetAvailableSourceSize() == 0), "uninflated bytes overwritten"); | ||
ULONG available = 0; | ||
self->m_compressedBuffer = std::make_unique<std::vector<std::uint8_t>>(BufferSize); | ||
self->m_compressedBuffer.swap(std::make_unique<std::vector<std::uint8_t>>(BufferSize)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is unclear what value this change is providing, unless there are bugs in the STL/compiler being used. |
||
ThrowHrIfFailed(self->m_stream->Read(self->m_compressedBuffer->data(), static_cast<ULONG>(self->m_compressedBuffer->size()), &available)); | ||
ThrowErrorIf(Error::FileRead, (available == 0), "Getting nothing back is unexpected here."); | ||
self->m_compressionObject->SetInput(self->m_compressedBuffer->data(), static_cast<size_t>(available)); | ||
|
@@ -55,7 +55,7 @@ namespace MSIX { | |
// State::READY_TO_INFLATE | ||
InflateHandler([](InflateStream* self, void*, ULONG) | ||
{ | ||
self->m_inflateWindow = std::make_unique<std::vector<std::uint8_t>>(BufferSize); | ||
self->m_inflateWindow.swap(std::make_unique<std::vector<std::uint8_t>>(BufferSize)); | ||
self->m_inflateWindowPosition = 0; | ||
self->m_compressionObject->SetOutput(self->m_inflateWindow->data(), self->m_inflateWindow->size()); | ||
self->m_compressionStatus = self->m_compressionObject->Inflate(); | ||
|
@@ -142,6 +142,8 @@ namespace MSIX { | |
|
||
InflateStream::~InflateStream() | ||
{ | ||
m_compressedBuffer = nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems odd that there is memory pressure from having this allocated while |
||
m_inflateWindow = nullptr; | ||
Cleanup(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with the change here; either our usage of unique_ptr is flawed and should be fixed, or this is unnecessary. Adding this additional overhead isn't the right answer.