From 2c8411425b6bfef06bda0c909370eb9632b25c3a Mon Sep 17 00:00:00 2001 From: ondrej Date: Mon, 17 Feb 2020 09:21:15 +0000 Subject: [PATCH] LazUtils: TFileStreamUTF8 = TFileStream: FPC 3.x has full UTF8 support and better exceptions (SFOpenError/SFOpenErrorEx). FileName was redeclared in TFileStreamUTF8 git-svn-id: trunk@62638 - --- components/lazutils/lazutf8classes.pas | 41 +------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/components/lazutils/lazutf8classes.pas b/components/lazutils/lazutf8classes.pas index af1dbe39f5..fabd074bfd 100644 --- a/components/lazutils/lazutf8classes.pas +++ b/components/lazutils/lazutf8classes.pas @@ -19,14 +19,7 @@ type { TFileStreamUTF8 } - TFileStreamUTF8 = class(TFileStream) - private - FFileName: string; - public - constructor Create(const AFileName: string; Mode: Word); - constructor Create(const AFileName: string; Mode: Word; Rights: Cardinal); - property FileName: string Read FFilename; - end; + TFileStreamUTF8 = TFileStream; { TStringListUTF8 } @@ -124,38 +117,6 @@ begin end; end; -constructor TFileStreamUTF8.Create(const AFileName: string; Mode: Word); -begin - Create(AFileName,Mode,438); - { Rights 438 is the default in the FCL TFileStream - Under Unix: - 438 = &666 = owner/group/others can read/write - Note: the real rights are "Rights and not umask" - Under Windows Rights is not used. - } -end; - -constructor TFileStreamUTF8.Create(const AFileName: string; Mode: Word; Rights: Cardinal); -var - lHandle: THandle; -begin - FFileName:=AFileName; - if (Mode and fmCreate) > 0 then - lHandle:=FileCreateUTF8(AFileName,Mode,Rights) - else - lHandle:=FileOpenUTF8(AFileName,Mode); - - if (THandle(lHandle)=feInvalidHandle) then - begin - if Mode=fmcreate then - raise EFCreateError.createfmt({SFCreateError}'Unable to create file "%s"',[AFileName]) - else - raise EFOpenError.Createfmt({SFOpenError}'Unable to open file "%s"',[AFilename]); - end - else - THandleStream(Self).Create(lHandle); -end; - function TStringListUTF8.DoCompareText(const s1, s2: string): PtrInt; begin if CaseSensitive then