cdcontrol relative address track off-by-one fix

Ben Woolley tautolog at gmail.com
Sun Sep 24 01:56:55 PDT 2006


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;




More information about the Submit mailing list