mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
sys: Improved ScopeGuard syntax a lot
This commit is contained in:
@@ -42,11 +42,12 @@ namespace hex::prv {
|
||||
this->m_writable = false;
|
||||
}
|
||||
|
||||
ScopeExit fileCleanup([this]{
|
||||
auto fileCleanup = SCOPE_GUARD {
|
||||
this->m_readable = false;
|
||||
this->m_file = nullptr;
|
||||
CloseHandle(this->m_file);
|
||||
});
|
||||
};
|
||||
|
||||
if (this->m_file == nullptr || this->m_file == INVALID_HANDLE_VALUE) {
|
||||
return;
|
||||
}
|
||||
@@ -56,11 +57,11 @@ namespace hex::prv {
|
||||
return;
|
||||
}
|
||||
|
||||
ScopeExit mappingCleanup([this]{
|
||||
auto mappingCleanup = SCOPE_GUARD {
|
||||
this->m_readable = false;
|
||||
this->m_mapping = nullptr;
|
||||
CloseHandle(this->m_mapping);
|
||||
});
|
||||
};
|
||||
|
||||
this->m_mappedFile = MapViewOfFile(this->m_mapping, FILE_MAP_ALL_ACCESS, 0, 0, this->m_fileSize);
|
||||
if (this->m_mappedFile == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user