Skip to content

Commit

Permalink
Fixed ASAN-related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Jan 12, 2024
1 parent 29975c4 commit 08ff504
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions Source/NimbleCommander/NimbleCommander/Core/Theming/Theme.mm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2016-2022 Michael Kazakov. Subject to GNU General Public License version 3.
// Copyright (C) 2016-2024 Michael Kazakov. Subject to GNU General Public License version 3.
#include "Theme.h"
#include <Panel/UI/PanelViewPresentationItemsColoringFilterPersistence.h>
#include "ThemePersistence.h"
Expand Down Expand Up @@ -118,12 +118,15 @@
? [NSAppearance appearanceNamed:NSAppearanceNameAqua]
: [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];

auto cr = &doc.FindMember("filePanelsColoringRules_v1")->value;
if( cr->IsArray() )
for( auto i = cr->Begin(), e = cr->End(); i != e; ++i ) {
auto rule = nc::panel::PresentationItemsColoringRulePersistence{}.FromJSON(*i);
I->m_ColoringRules.emplace_back(std::move(rule));
if( const auto rules_it = doc.FindMember("filePanelsColoringRules_v1"); rules_it != doc.MemberEnd() ) {
if( const auto &cr = rules_it->value; cr.IsArray() ) {
for( auto i = cr.Begin(), e = cr.End(); i != e; ++i ) {
auto rule = nc::panel::PresentationItemsColoringRulePersistence{}.FromJSON(*i);
I->m_ColoringRules.emplace_back(std::move(rule));
}
}
}

// always have a default ("others") non-filtering filter at the back
I->m_ColoringRules.emplace_back();

Expand Down
2 changes: 1 addition & 1 deletion Source/VFS/tests/VFSArchive_UT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ TEST_CASE(PREFIX "Can unzip an archive with Cyrillic symbols")
auto bytes = file->ReadFile();
REQUIRE(bytes);
REQUIRE(bytes->size() == 3);
CHECK(std::memcmp(bytes->data(), "123", 4) == 0);
CHECK(std::memcmp(bytes->data(), "123", 3) == 0);
};
check({reinterpret_cast<const std::byte *>(__1_zip), __1_zip_len});
check({reinterpret_cast<const std::byte *>(__2_zip), __2_zip_len});
Expand Down

0 comments on commit 08ff504

Please sign in to comment.