Skip to content

Commit

Permalink
fix int format in search results
Browse files Browse the repository at this point in the history
Since `trackId` is an `Int` and can be a number greater than `Int32.max`,
it should be printed with the `%ld` format specifier [1].

[1]: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW5
  • Loading branch information
algorythmic committed May 14, 2024
1 parent 763392c commit 56bad37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/MasKit/Formatters/SearchResultFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ enum SearchResultFormatter {
let price = result.price ?? 0.0

if includePrice {
output += String(format: "%12d %@ $%5.2f (%@)\n", appId, appName, price, version)
output += String(format: "%12ld %@ $%5.2f (%@)\n", appId, appName, price, version)
} else {
output += String(format: "%12d %@ (%@)\n", appId, appName, version)
output += String(format: "%12ld %@ (%@)\n", appId, appName, version)
}
}

Expand Down

0 comments on commit 56bad37

Please sign in to comment.