Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: dgelessus <dgelessus@users.noreply.github.com>
  • Loading branch information
colincornaby and dgelessus authored Feb 18, 2024
1 parent 16c7924 commit 926c708
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -282,19 +282,19 @@ 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;
}
}
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;
Expand Down

0 comments on commit 926c708

Please sign in to comment.