[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 1/5] Pascal-RTL: Fixes fuer Dateifunktionen
! Pascal-RTL: Wenn das fopen schiefgeht, sollte man das auch
weitermelden
! Pascal-RTL: ftell als cdecl zu deklarieren waere vermutlich gar nicht
so doof
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/modules/pas/lib/rtl/sysfile.inc | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/modules/pas/lib/rtl/sysfile.inc b/src/modules/pas/lib/rtl/sysfile.inc
index fceeb22..ca2ac75 100644
--- a/src/modules/pas/lib/rtl/sysfile.inc
+++ b/src/modules/pas/lib/rtl/sysfile.inc
@@ -9,6 +9,7 @@ function c_fclose(f: THandle): integer; cdecl; external name 'fclose';
function c_fwrite(src: Pointer; blocksize, blockcount: TSize; f: THandle): TSize; cdecl; external name 'fwrite';
function c_fread(dest: Pointer; blocksize, blockcount: TSize; f: THandle): TSize; cdecl; external name 'fread';
function c_fseek(f: THandle; offset, whence: longint): longint; cdecl; external name 'fseek';
+function c_ftell(f: THandle): TSize; cdecl; external name 'ftell';
function c_feof(f: THandle): boolean; cdecl; external name 'feof';
@@ -46,7 +47,10 @@ begin
until (Do_Read <> 0) or (c_feof(f));
end;
-function Do_FilePos(f: THandle): TSize; external name 'ftell';
+function Do_FilePos(f: THandle): TSize;
+begin
+ Do_FilePos := c_ftell(f);
+end;
Procedure Do_Seek(f: THandle; position: TSize);
begin
@@ -112,7 +116,11 @@ begin
end;
frec^.handle := c_fopen(name, @c_mode[1]);
- c_setvbuf(frec^.handle, nil, 1, 0);
+ if frec^.handle < 0 then begin
+ InOutRes := 2;
+ end else begin
+ c_setvbuf(frec^.handle, nil, 1, 0);
+ end;
end else begin
--
1.6.0.2