some fixes to accented characters
[tangerine.git] / rom / dos / internalflush.c
blob27d4ada4a0efe37d3eb5927dce04b6a2b6e48654
1 /*
2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #undef SDEBUG
7 #undef DEBUG
8 #define DEBUG 0
10 #include <exec/types.h>
11 #include <proto/dos.h>
12 #include <aros/debug.h>
14 #include "dos_intern.h"
16 LONG InternalFlush( struct FileHandle *fh, struct DosLibrary *DOSBase )
18 UBYTE *position;
20 /* Make sure the input parameters are sane. */
21 ASSERT_VALID_PTR( fh );
22 ASSERT_VALID_PTR( fh->fh_Buf );
23 ASSERT_VALID_PTR( fh->fh_Pos );
24 ASSERT_VALID_PTR( fh->fh_End );
26 ASSERT(fh->fh_End > fh->fh_Buf);
27 ASSERT(fh->fh_Pos >= fh->fh_Buf);
28 ASSERT(fh->fh_Pos <= fh->fh_End );
30 /* Write the data, in many pieces if the first one isn't enough. */
31 position = fh->fh_Buf;
33 while( position < fh->fh_Pos )
35 LONG size;
37 size = Write( MKBADDR(fh), position, fh->fh_Pos - position );
39 /* An error happened? No success. */
40 if( size < 0 )
42 fh->fh_Flags &= ~FHF_WRITE;
44 return FALSE;
47 position += size;
50 /* Reset the buffer. */
51 fh->fh_Pos = fh->fh_Buf;
53 return TRUE;