From 926c70860ded0ef0be3227cd6fc0fe979f01ee53 Mon Sep 17 00:00:00 2001 From: Colin Cornaby Date: Sat, 17 Feb 2024 18:37:11 -0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: dgelessus --- Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm b/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm index dada51c2a4..7955eadb0c 100644 --- a/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm +++ b/Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm @@ -242,7 +242,7 @@ static la_ssize_t copy_data(struct archive *ar, struct archive *aw) struct archive *ext = archive_write_disk_new(); archive_write_disk_set_options(ext, flags); archive_write_disk_set_standard_lookup(ext); - if ((r = archive_read_open_filename(a, file.GetFileName().c_str(), 10240))) { + if ((r = archive_read_open_filename(a, file.GetFileName().c_str(), 10240)) != ARCHIVE_OK) { // couldn't read return; } @@ -272,7 +272,7 @@ static la_ssize_t copy_data(struct archive *ar, struct archive *aw) if (r == ARCHIVE_EOF) break; if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(a)); + pfPatcher::GetLog()->AddLineF(plStatusLog::kRed, "Failed to read bundle archive: {}", archive_error_string(a)); if (r < ARCHIVE_WARN) { succeeded = false; break; @@ -282,11 +282,11 @@ static la_ssize_t copy_data(struct archive *ar, struct archive *aw) archive_entry_set_pathname(entry, fullOutputPath.c_str()); r = archive_write_header(ext, entry); if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); + pfPatcher::GetLog()->AddLineF(plStatusLog::kRed, "Failed to extract file while patching app bundle: {}", archive_error_string(ext)); else if (archive_entry_size(entry) > 0) { r = copy_data(a, ext); if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); + pfPatcher::GetLog()->AddLineF(plStatusLog::kRed, "Failed to extract file while patching app bundle: {}", archive_error_string(ext)); if (r < ARCHIVE_WARN) { succeeded = false; break; @@ -294,7 +294,7 @@ static la_ssize_t copy_data(struct archive *ar, struct archive *aw) } r = archive_write_finish_entry(ext); if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); + pfPatcher::GetLog()->AddLineF(plStatusLog::kRed, "Failed to extract file while patching app bundle: {}", archive_error_string(ext)); if (r < ARCHIVE_WARN) { succeeded = false; break;