Dead code in dlls/ntdll/tape.c

Hans Leidekker hans at it.vu.nl
Thu Nov 1 16:07:16 CDT 2007


On Thursday 01 November 2007 21:22:14 Gerald Pfeifer wrote:

> We currently have the following code in tape.c:
> 
>         if (data->Offset.u.LowPart >= 0) {
>             cmd.mt_op = MTFSF;
>             cmd.mt_count = data->Offset.u.LowPart;
>         }
>         else {
>             cmd.mt_op = MTBSF;
>             cmd.mt_count = -data->Offset.u.LowPart;
>         }

> Offset is of type LARGE_INTEGER which is defined as
> 
>     struct {
>         DWORD    LowPart;
>         LONG     HighPart;
>     } u;
> 
> Note how LowPart is unsigned (DWORD) here, so indeed the comparisons
> for >= 0 is always going to evaluate to true.

Yes, the comparison should be against data->Offset.QuadPart (which you
left out of the definition of LARGE_INTEGER).

I'll work on a fix.

 -Hans



More information about the wine-devel mailing list