Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/cdplay 0 is a valid value for the absolute minute to...



details:   https://anonhg.NetBSD.org/src/rev/e5f523976090
branches:  trunk
changeset: 537270:e5f523976090
user:      is <is%NetBSD.org@localhost>
date:      Sat Sep 28 21:48:35 2002 +0000

description:
0 is a valid value for the absolute minute to stop playing. Initialize
to UINT_MAX before scanning, and check for UINT_MAX to detect whether it
was set.
Without this, it is not possible to play the first less than a minute of
a CD using absolute msf addresses.

diffstat:

 usr.bin/cdplay/cdplay.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r e527232f97f6 -r e5f523976090 usr.bin/cdplay/cdplay.c
--- a/usr.bin/cdplay/cdplay.c   Sat Sep 28 21:23:12 2002 +0000
+++ b/usr.bin/cdplay/cdplay.c   Sat Sep 28 21:48:35 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdplay.c,v 1.20 2002/06/11 06:06:18 itojun Exp $       */
+/*     $NetBSD: cdplay.c,v 1.21 2002/09/28 21:48:35 is Exp $   */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Andrew Doran.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: cdplay.c,v 1.20 2002/06/11 06:06:18 itojun Exp $");
+__RCSID("$NetBSD: cdplay.c,v 1.21 2002/09/28 21:48:35 is Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -54,6 +54,7 @@
 #include <err.h>
 #include <errno.h>
 #include <histedit.h>
+#include <limits.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -672,6 +673,8 @@
                return (play_msf(m1, s1, f1, m2, s2, f2));
 
 Try_Absolute_Timed_Addresses:
+               m2 = UINT_MAX;
+
                if (6 != sscanf(arg, "%d:%d.%d%d:%d.%d",
                        &m1, &s1, &f1, &m2, &s2, &f2) &&
                    5 != sscanf(arg, "%d:%d.%d%d:%d", &m1, &s1, &f1, &m2, &s2) &&
@@ -681,7 +684,7 @@
                    2 != sscanf(arg, "%d:%d", &m1, &s1))
                        goto Clean_up;
 
-               if (m2 == 0) {
+               if (m2 == UINT_MAX) {
                        if (msf) {
                                m2 = toc_buffer[n].addr.msf.minute;
                                s2 = toc_buffer[n].addr.msf.second;



Home | Main Index | Thread Index | Old Index