Re: PATCH: /dlls/ntdll/cdrom.c -- portability breakage

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

 



Thank you for reporting this issue of portability breach. I appologize for the inconvenience. Your correction seems sound, but I think there is no need to remove the trace line which can be useful for debugging cdrom.c. Just change it the way I'm proposing below and it should be portable.

Best,
Waldeck

Gerald Pfeifer wrote:

The following patch broke FreeBSD (and other non-Linux system) in three
places:

revision 1.25
date: 2003/02/19 22:08:50; author: julliard; state: Exp; lines: +433 -180
Waldeck Schutzer <schutzer@math.rutgers.edu>
- Some systems/drives are very slow to read the TOC. To address this
issue, we are caching it inside the driver.
- Windows will seek while not playing, Linux will not. We are
providing better compatibility with Windows by also caching the
current position.

My patch below fixes two of these.

Gerald


ChangeLog:
Define CD_SECS and CD_FRAMES also on non-Linux systems. Avoid a
non-portable TRACE on non-Linux systems.

Index: cdrom.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/cdrom.c,v
retrieving revision 1.25
diff -u -3 -p -r1.25 cdrom.c
--- cdrom.c 19 Feb 2003 22:08:50 -0000 1.25
+++ cdrom.c 20 Feb 2003 09:24:43 -0000
@@ -72,6 +72,15 @@
#include "file.h"
#include "wine/debug.h"

+/* Non-Linux systems do not have linux/cdrom.h and the like, and thus
+ lack the following constants. */
+
+#ifndef CD_SECS
+ #define CD_SECS 60 /* seconds per minute */
+#endif
+#ifndef CD_FRAMES
+ #define CD_FRAMES 75 /* frames per second */
+#endif

static const struct iocodexs
{
@@ -285,8 +294,10 @@ static int CDROM_SyncCache(int dev)
+ sizeof(TRACK_DATA) * (toc->LastTrack-toc->FirstTrack+2);
toc->Length[0] = tsz >> 8;
toc->Length[1] = tsz;
-
+
+#ifdef linux
TRACE("caching toc from=%d to=%d\n", hdr.cdth_trk0, hdr.cdth_trk1);
+#endif

for (i = toc->FirstTrack; i <= toc->LastTrack + 1; i++)
{





Index: wine/dlls/ntdll/cdrom.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/cdrom.c,v
retrieving revision 1.25
diff -u -p -r1.25 cdrom.c
--- wine/dlls/ntdll/cdrom.c	19 Feb 2003 22:08:50 -0000	1.25
+++ wine/dlls/ntdll/cdrom.c	20 Feb 2003 12:33:06 -0000
@@ -114,6 +114,13 @@ static const char *iocodex(DWORD code)
 
 WINE_DEFAULT_DEBUG_CHANNEL(cdrom);
 
+#ifndef CD_SECS
+ #define CD_SECS 60
+#endif
+#ifndef CD_FRAMES
+ #define CD_FRAMES 75
+#endif
+
 #define FRAME_OF_ADDR(a) (((int)(a)[1] * CD_SECS + (a)[2]) * CD_FRAMES + (a)[3])
 #define FRAME_OF_MSF(a) (((int)(a).M * CD_SECS + (a).S) * CD_FRAMES + (a).F)
 #define FRAME_OF_TOC(toc, idx)  FRAME_OF_ADDR((toc).TrackData[idx - (toc).FirstTrack].Address)
@@ -286,7 +293,7 @@ static int CDROM_SyncCache(int dev)
     toc->Length[0] = tsz >> 8;
     toc->Length[1] = tsz;
    
-    TRACE("caching toc from=%d to=%d\n", hdr.cdth_trk0, hdr.cdth_trk1);
+    TRACE("caching toc from=%d to=%d\n", toc->FirstTrack, toc->LastTrack);
 
     for (i = toc->FirstTrack; i <= toc->LastTrack + 1; i++)
     {

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux