Address more feedback

This commit is contained in:
Adubbz 2020-02-25 23:52:55 +11:00
parent 649e708d5c
commit b6c9bf42df
41 changed files with 69 additions and 70 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -18,16 +18,16 @@
namespace ams::lr::impl {
class LocationRedirection : public util::IntrusiveListBaseNode<LocationRedirection> {
NON_COPYABLE(LocationRedirection);
NON_MOVEABLE(LocationRedirection);
class LocationRedirector::Redirection : public util::IntrusiveListBaseNode<Redirection> {
NON_COPYABLE(Redirection);
NON_MOVEABLE(Redirection);
private:
ncm::ProgramId program_id;
ncm::ProgramId owner_id;
Path path;
u32 flags;
public:
LocationRedirection(ncm::ProgramId program_id, ncm::ProgramId owner_id, const Path& path, u32 flags) :
Redirection(ncm::ProgramId program_id, ncm::ProgramId owner_id, const Path& path, u32 flags) :
program_id(program_id), owner_id(owner_id), path(path), flags(flags) { /* ... */ }
ncm::ProgramId GetProgramId() const {
@ -52,10 +52,6 @@ namespace ams::lr::impl {
};
bool LocationRedirector::FindRedirection(Path *out, ncm::ProgramId program_id) {
if (this->redirection_list.empty()) {
return false;
}
for (const auto &redirection : this->redirection_list) {
if (redirection.GetProgramId() == program_id) {
redirection.GetPath(out);
@ -71,7 +67,7 @@ namespace ams::lr::impl {
void LocationRedirector::SetRedirection(ncm::ProgramId program_id, ncm::ProgramId owner_id, const Path &path, u32 flags) {
this->EraseRedirection(program_id);
this->redirection_list.push_back(*(new LocationRedirection(program_id, owner_id, path, flags)));
this->redirection_list.push_back(*(new Redirection(program_id, owner_id, path, flags)));
}
void LocationRedirector::SetRedirectionFlags(ncm::ProgramId program_id, u32 flags) {
@ -98,7 +94,7 @@ namespace ams::lr::impl {
if ((it->GetFlags() & flags) == flags) {
auto old = it;
it = this->redirection_list.erase(it);
delete &(*old);
delete std::addressof(*old);
} else {
it++;
}
@ -114,7 +110,7 @@ namespace ams::lr::impl {
auto old = it;
it = this->redirection_list.erase(it);
delete &(*old);
delete std::addressof(*old);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -24,16 +24,19 @@ namespace ams::lr::impl {
RedirectionFlags_None = (0 << 0),
RedirectionFlags_Application = (1 << 0),
};
class LocationRedirection;
class LocationRedirector {
NON_COPYABLE(LocationRedirector);
NON_MOVEABLE(LocationRedirector);
private:
ams::util::IntrusiveListBaseTraits<LocationRedirection>::ListType redirection_list;
class Redirection;
private:
using RedirectionList = ams::util::IntrusiveListBaseTraits<Redirection>::ListType;
private:
RedirectionList redirection_list;
public:
LocationRedirector() { /* ... */ }
~LocationRedirector() { this->ClearRedirections(); }
bool FindRedirection(Path *out, ncm::ProgramId program_id);
void SetRedirection(ncm::ProgramId program_id, const Path &path, u32 flags = RedirectionFlags_None);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -33,15 +33,15 @@ namespace ams::lr::impl {
};
private:
Entry entries[NumEntries];
size_t soft_entry_limit;
size_t capacity;
public:
RegisteredData(size_t soft_entry_limit = NumEntries) : soft_entry_limit(soft_entry_limit) {
RegisteredData(size_t capacity = NumEntries) : capacity(capacity) {
this->Clear();
}
bool Register(const Key &key, const Value &value, const ncm::ProgramId owner_id) {
/* Try to find an existing value. */
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
entry.value = value;
@ -49,7 +49,7 @@ namespace ams::lr::impl {
}
}
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
if (!entry.is_valid) {
entry.key = key;
@ -64,7 +64,7 @@ namespace ams::lr::impl {
}
void Unregister(const Key &key) {
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
entry.is_valid = false;
@ -73,7 +73,7 @@ namespace ams::lr::impl {
}
void UnregisterOwnerProgram(ncm::ProgramId owner_id) {
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
if (entry.owner_id == owner_id) {
entry.is_valid = false;
@ -82,7 +82,7 @@ namespace ams::lr::impl {
}
bool Find(Value *out, const Key &key) {
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
if (entry.is_valid && entry.key == key) {
*out = entry.value;
@ -94,13 +94,13 @@ namespace ams::lr::impl {
}
void Clear() {
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
this->entries[i].is_valid = false;
}
}
void ClearExcluding(const ncm::ProgramId* ids, size_t num_ids) {
for (size_t i = 0; i < this->GetSoftEntryLimit(); i++) {
for (size_t i = 0; i < this->GetCapacity(); i++) {
Entry& entry = this->entries[i];
bool found = false;
@ -119,8 +119,8 @@ namespace ams::lr::impl {
}
}
size_t GetSoftEntryLimit() const {
return this->soft_entry_limit;
size_t GetCapacity() const {
return this->capacity;
}
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -77,7 +77,7 @@ namespace ams::ncm::impl {
}
/* We ran out of space in the map. */
std::abort();
AMS_ABORT();
}
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -108,7 +108,7 @@ namespace ams::ncm::impl {
return 2;
}
std::abort();
AMS_ABORT();
}
void PlaceHolderAccessor::GetPath(char* placeholder_path_out, PlaceHolderId placeholder_id) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -62,7 +62,7 @@ namespace ams::ncm {
return 3;
}
std::abort();
AMS_ABORT();
}
Result ContentStorageInterface::OpenCachedContentFile(ContentId content_id) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@ -257,7 +257,7 @@ namespace ams::ncm::fs {
break;
default:
std::abort();
AMS_ABORT();
};
return ResultSuccess();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 Adubbz, Atmosphere-NX
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,