More minor cleanups

This commit is contained in:
Henrik Rydgård
2025-05-29 13:39:33 +02:00
parent 5eb87f0fb4
commit a361a32f4b
3 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ bool containsNoCase(std::string_view haystack, std::string_view needle) {
return found != haystack.end();
}
int countChar(std::string_view haystack, char needle) {
int CountChar(std::string_view haystack, char needle) {
int count = 0;
for (int i = 0; i < (int)haystack.size(); i++) {
if (haystack[i] == needle) {
+1 -1
View File
@@ -1253,7 +1253,7 @@ void MainScreen::CreateViews() {
if (versionString[0] == 'v' && isdigit(versionString[1])) {
versionString = versionString.substr(1);
}
if (countChar(versionString, '-') == 2) {
if (CountChar(versionString, '-') == 2) {
// Shorten the commit hash.
size_t cutPos = versionString.find_last_of('-') + 8;
versionString = versionString.substr(0, std::min(cutPos, versionString.size()));
+8 -9
View File
@@ -474,6 +474,13 @@ ConfirmMemstickMoveScreen::ConfirmMemstickMoveScreen(const Path &newMemstickFold
if (initialSetup_) {
moveData_ = false;
}
newSpaceTask_ = Promise<SpaceResult *>::Spawn(&g_threadManager, [newMemstickFolder]() -> SpaceResult * {
int64_t freeSpaceNew;
INFO_LOG(Log::System, "Computing free space in '%s'", newMemstickFolder.c_str());
free_disk_space(newMemstickFolder, freeSpaceNew);
return new SpaceResult{ freeSpaceNew };
}, TaskType::IO_BLOCKING, TaskPriority::HIGH);
}
ConfirmMemstickMoveScreen::~ConfirmMemstickMoveScreen() {
@@ -515,14 +522,6 @@ void ConfirmMemstickMoveScreen::CreateViews() {
// TODO: Add spinner
newFreeSpaceView_ = leftColumn->Add(new TextView(ApplySafeSubstitutions("%1: ...", ms->T("Free space")), ALIGN_LEFT, false));
Path newMemstickFolder = newMemstickFolder_;
newSpaceTask_ = Promise<SpaceResult *>::Spawn(&g_threadManager, [newMemstickFolder]() -> SpaceResult * {
int64_t freeSpaceNew;
INFO_LOG(Log::System, "Computing free space in %s", newMemstickFolder.c_str());
free_disk_space(newMemstickFolder, freeSpaceNew);
return new SpaceResult{ freeSpaceNew };
}, TaskType::IO_BLOCKING, TaskPriority::HIGH);
if (existingFilesInNewFolder_) {
leftColumn->Add(new NoticeView(NoticeLevel::SUCCESS, ms->T("Already contains PSP data"), ""));
if (!moveData_) {
@@ -621,7 +620,7 @@ UI::EventReturn ConfirmMemstickMoveScreen::OnConfirm(UI::EventParams &params) {
Path moveSrc = g_Config.memStickDirectory;
Path moveDest = newMemstickFolder_;
MoveResult *result = MoveDirectoryContentsSafe(moveSrc, moveDest, progressReporter_);
NOTICE_LOG(Log::System, "Move task finished: %b", result != nullptr);
NOTICE_LOG(Log::System, "Move task finished: %d", (int)(result != nullptr));
return result;
}, TaskType::IO_BLOCKING, TaskPriority::HIGH);