ISOFileSystem: Some const correctness

This commit is contained in:
Henrik Rydgård
2026-02-06 12:00:53 +01:00
parent f2116c4236
commit c85496c84d
2 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -184,7 +184,7 @@ std::string ISOFileSystem::TreeEntry::BuildPath() {
}
}
void ISOFileSystem::ReadDirectory(TreeEntry *root) {
void ISOFileSystem::ReadDirectory(TreeEntry *root) const {
for (u32 secnum = root->startsector, endsector = root->startsector + (root->dirsize + 2047) / 2048; secnum < endsector; ++secnum) {
u8 theSector[2048];
if (!blockDevice->ReadBlock(secnum, theSector)) {
@@ -255,7 +255,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
root->valid = true;
}
ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bool catchError) {
const ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bool catchError) {
const size_t pathLength = path.length();
if (pathLength == 0) {
@@ -625,7 +625,7 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) {
return fileInfo;
}
TreeEntry *entry = GetFromPath(filename, false);
const TreeEntry *entry = GetFromPath(filename, false);
PSPFileInfo x;
if (entry) {
x.name = entry->name;
@@ -659,7 +659,7 @@ PSPFileInfo ISOFileSystem::GetFileInfoByHandle(u32 handle) {
std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::vector<PSPFileInfo> myVector;
TreeEntry *entry = GetFromPath(path);
const TreeEntry *entry = GetFromPath(path);
if (!entry) {
if (exists)
*exists = false;
@@ -673,7 +673,7 @@ std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(const std::string &path, b
const std::string dotdot("..");
for (size_t i = 0; i < entry->children.size(); i++) {
TreeEntry *e = entry->children[i];
const TreeEntry *e = entry->children[i];
// do not include the relative entries in the list
if (e->name == dot || e->name == dotdot)
@@ -697,12 +697,12 @@ std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(const std::string &path, b
return myVector;
}
std::string ISOFileSystem::EntryFullPath(TreeEntry *e) {
std::string ISOFileSystem::EntryFullPath(const TreeEntry *e) {
if (e == &entireISO)
return "";
size_t fullLen = 0;
TreeEntry *cur = e;
const TreeEntry *cur = e;
while (cur != NULL && cur != treeroot) {
// For the "/".
fullLen += 1 + cur->name.size();