cd-discid: fix patch

This commit is contained in:
FX Coudert 2019-10-21 19:30:28 +02:00
parent 9212f63ff3
commit 0456a1e810

View file

@ -11,7 +11,10 @@ class CdDiscid < Formula
# macOS fix; see https://github.com/Homebrew/homebrew/issues/46267
# Already fixed in upstream head; remove when bumping version to >1.4
patch :DATA
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/85fa66a9/cd-discid/1.4.patch"
sha256 "f53b660ae70e91174ab86453888dbc3b9637ba7fcaae4ea790855b7c3d3fe8e6"
end
end
bottle do
@ -35,43 +38,3 @@ class CdDiscid < Formula
assert_equal "cd-discid #{version}.", shell_output("#{bin}/cd-discid --version 2>&1").chomp
end
end
__END__
diff --git a/cd-discid.c b/cd-discid.c
index 9b0b40a..2c96641 100644
--- a/cd-discid.c
+++ b/cd-discid.c
@@ -93,7 +93,7 @@
#define cdth_trk1 lastTrackNumberInLastSessionLSB
#define cdrom_tocentry CDTrackInfo
#define cdte_track_address trackStartAddress
-#define DEVICE_NAME "/dev/disk1"
+#define DEVICE_NAME "/dev/rdisk1"
#else
#error "Your OS isn't supported yet."
@@ -236,8 +236,7 @@ int main(int argc, char *argv[])
* TocEntry[last-1].lastRecordedAddress + 1, so we compute the start
* of leadout from the start+length of the last track instead
*/
- TocEntry[last].cdte_track_address = TocEntry[last - 1].trackSize +
- TocEntry[last - 1].trackStartAddress;
+TocEntry[last].cdte_track_address = htonl(ntohl(TocEntry[last-1].trackSize) + ntohl(TocEntry[last-1].trackStartAddress));
#else /* FreeBSD, Linux, Solaris */
for (i = 0; i < last; i++) {
/* tracks start with 1, but I must start with 0 on OpenBSD */
@@ -260,12 +259,12 @@ int main(int argc, char *argv[])
/* release file handle */
close(drive);
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
TocEntry[i].cdte_track_address = ntohl(TocEntry[i].cdte_track_address);
#endif
for (i = 0; i < last; i++) {
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
TocEntry[i].cdte_track_address = ntohl(TocEntry[i].cdte_track_address);
#endif
cksum += cddb_sum((TocEntry[i].cdte_track_address + CD_MSF_OFFSET) / CD_FRAMES);