codetools: using TFileStreamUTF8

git-svn-id: trunk@37653 -
This commit is contained in:
mattias 2012-06-15 16:21:53 +00:00
parent a9cea90ffd
commit 9175dedadf
4 changed files with 15 additions and 15 deletions

View File

@ -53,7 +53,7 @@ interface
uses
Classes, SysUtils, LazUTF8, CodeToolsStrConsts, ExprEval, DirectoryCacher,
BasicCodeTools, Laz2_XMLCfg, AVL_Tree, CodeToolsStructs,
BasicCodeTools, Laz2_XMLCfg, lazutf8classes, AVL_Tree, CodeToolsStructs,
Process, KeywordFuncLists, LinkScanner, FileProcs;
const
@ -1513,7 +1513,7 @@ var
Filename: String;
WorkDir: String;
List: TStringList;
fs: TFileStream;
fs: TFileStreamUTF8;
begin
Result:=false;
ConfigFiles:=nil;
@ -1524,7 +1524,7 @@ begin
// create empty file
try
fs:=TFileStream.Create(UTF8ToSys(TestFilename),fmCreate);
fs:=TFileStreamUTF8.Create(TestFilename,fmCreate);
fs.Free;
except
debugln(['RunFPCVerbose unable to create test file "'+TestFilename+'"']);

View File

@ -43,7 +43,7 @@ uses
MemCheck,
{$ENDIF}
Classes, SysUtils, LazUTF8, LazDbgLog, LazFileCache, LazFileUtils,
AVL_Tree, CodeToolsStrConsts;
lazutf8classes, AVL_Tree, CodeToolsStrConsts;
type
TFPCStreamSeekType = int64;
@ -667,12 +667,12 @@ end;
-------------------------------------------------------------------------------}
function ClearFile(const Filename: string; RaiseOnError: boolean): boolean;
var
fs: TFileStream;
fs: TFileStreamUTF8;
begin
if FileExistsUTF8(Filename) then begin
try
InvalidateFileStateCache(Filename);
fs:=TFileStream.Create(UTF8ToSys(Filename),fmOpenWrite);
fs:=TFileStreamUTF8.Create(Filename,fmOpenWrite);
fs.Size:=0;
fs.Free;
except

View File

@ -37,7 +37,7 @@ unit PPUParser;
interface
uses
Classes, SysUtils, FileProcs, contnrs;
Classes, SysUtils, FileProcs, lazutf8classes, contnrs;
const
PPUIsEndianBig = {$IFDEF ENDIAN_BIG}True{$ELSE}False{$ENDIF};
@ -2258,9 +2258,9 @@ end;
procedure TPPU.LoadFromFile(const Filename: string; const Parts: TPPUParts);
var
ms: TMemoryStream;
fs: TFileStream;
fs: TFileStreamUTF8;
begin
fs:=TFileStream.Create(UTF8ToSys(Filename),fmOpenRead or fmShareDenyWrite);
fs:=TFileStreamUTF8.Create(Filename,fmOpenRead or fmShareDenyWrite);
ms:=TMemoryStream.Create;
try
ms.Size:=fs.Size;

View File

@ -36,7 +36,7 @@ uses
{$IFDEF MEM_CHECK}
MemCheck,
{$ENDIF}
Classes, SysUtils, FileProcs, LazUTF8;
Classes, SysUtils, FileProcs, LazUTF8, lazutf8classes;
type
TSourceLog = class;
@ -813,13 +813,13 @@ end;
function TSourceLog.LoadFromFile(const Filename: string): boolean;
var
s: string;
fs: TFileStream;
fs: TFileStreamUTF8;
p: Integer;
begin
Result := False;
LastError:='';
try
fs := TFileStream.Create(UTF8ToSys(Filename), fmOpenRead or fmShareDenyNone);
fs := TFileStreamUTF8.Create(Filename, fmOpenRead or fmShareDenyNone);
try
SetLength(s, fs.Size);
if s <> '' then
@ -869,7 +869,7 @@ end;
function TSourceLog.SaveToFile(const Filename: string): boolean;
var
fs: TFileStream;
fs: TFileStreamUTF8;
s: String;
begin
{$IFDEF VerboseCTSave}
@ -882,11 +882,11 @@ begin
// keep filename case on disk
if FileExistsUTF8(Filename) then begin
InvalidateFileStateCache(Filename);
fs := TFileStream.Create(UTF8ToSys(Filename), fmOpenWrite or fmShareDenyNone);
fs := TFileStreamUTF8.Create(Filename, fmOpenWrite or fmShareDenyNone);
fs.Size := 0;
end else begin
InvalidateFileStateCache; // invalidate all (samba shares)
fs := TFileStream.Create(UTF8ToSys(Filename), fmCreate);
fs := TFileStreamUTF8.Create(Filename, fmCreate);
end;
try
s := Source;