2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
5 DOS stream handler. Used in InitIFFasDOS.
9 #include <aros/debug.h>
10 #include "iffparse_intern.h"
12 /********************/
13 /* DosStreamHandler */
14 /********************/
16 #define IFFParseBase IPB(hook->h_Data)
18 ULONG DOSStreamHandler
21 struct IFFHandle
* iff
,
22 struct IFFStreamCmd
* cmd
27 DEBUG_DOSSTREAMHANDLER(dprintf("DOSStreamHandler: hook %p iff %p cmd %p\n", hook
, iff
, cmd
));
29 switch (cmd
->sc_Command
)
32 DEBUG_BUFSTREAMHANDLER(dprintf("DOSStreamHandler: IFFCMD_READ...\n"));
33 D(bug(" Reading %ld bytes\n", cmd
->sc_NBytes
));
36 (BPTR
)iff
->iff_Stream
,
38 cmd
->sc_NBytes
) != cmd
->sc_NBytes
;
43 DEBUG_BUFSTREAMHANDLER(dprintf("DOSStreamHandler: IFFCMD_WRITE...\n"));
44 D(bug(" Writing %ld bytes\n", cmd
->sc_NBytes
));
47 (BPTR
)iff
->iff_Stream
,
49 cmd
->sc_NBytes
) != cmd
->sc_NBytes
;
54 DEBUG_BUFSTREAMHANDLER(dprintf("DOSStreamHandler: IFFCMD_SEEK...\n"));
55 D(bug(" Seeking %ld bytes\n", cmd
->sc_NBytes
));
57 error
= Seek((BPTR
)iff
->iff_Stream
, cmd
->sc_NBytes
, OFFSET_CURRENT
) == -1;
63 DEBUG_BUFSTREAMHANDLER(dprintf("DOSStreamHandler: IFFCMD_INIT...\n"));
65 /* Don't need these for dos streams
72 DEBUG_BUFSTREAMHANDLER(dprintf("DOSStreamHandler: IFFCMD_CLEANUP...\n"));
74 /* Force stream to beginning, some applications assume stream is at
75 beginning after failed OpenIFF()'s IFFCMD_CLEANUP. This fixed pbs
76 with multiview and certain jpeg files, for example. - Piru
78 error
= Seek((BPTR
)iff
->iff_Stream
, 0, OFFSET_BEGINNING
) == -1;
82 DEBUG_DOSSTREAMHANDLER(dprintf("DOSStreamHandler: return %ld\n", error
));