DragonFly BSD
DragonFly submit List (threaded) for 2006-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

cdcontrol relative address track off-by-one fix


From: "Ben Woolley" <tautolog@xxxxxxxxx>
Date: Sun, 24 Sep 2006 04:52:42 -0400

Before the patch, I would do:
cdcontrol 1 0:15
and it would play from track 2, 0:15, not track 1.

That seemed to be caused by tr1-- being after toc_buffer[tr1], and
toc_buffer[1] is track 2.

I looked for similar problems, but did not find any.

Cheers,

Ben Woolley
--- cdcontrol.c.old	2006-09-24 03:46:48.000000000 -0400
+++ cdcontrol.c	2006-09-24 04:17:35.000000000 -0400
@@ -586,6 +586,8 @@
 		else if (tr1 > n)
 			tr1 = n;
 
+		tr1--;
+
 		if (msf) {
 			tm = toc_buffer[tr1].addr.msf.minute;
 			ts = toc_buffer[tr1].addr.msf.second;
@@ -598,12 +600,10 @@
 		    && ((s1 > ts)
 		    || ((s1 == ts)
 		    && (f1 > tf))))) {
-			printf ("Track %d is not that long.\n", tr1);
+			printf ("Track %d is not that long.\n", tr1 + 1);
 			return (0);
 		}
 
-		tr1--;
-
 		f1 += tf;
 		if (f1 >= 75) {
 			s1 += f1 / 75;


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]