Converter: Remove unused code. Turn a private method FixWideString into a function.

git-svn-id: trunk@60032 -
This commit is contained in:
juha 2019-01-08 10:52:39 +00:00
parent abbb0f061a
commit 411c7643fd

View File

@ -58,8 +58,6 @@ type
private
fSettings: TConvertSettings;
fOrigFormat: TLRSStreamOriginalFormat;
function FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
function GetLFMFilename(const DfmFilename: string; KeepCase: boolean): string;
public
constructor Create;
destructor Destroy; override;
@ -147,54 +145,7 @@ begin
and (TLFMObjectNode(Node).TypeName<>'');
end;
{ TDFMConverter }
constructor TDFMConverter.Create;
begin
inherited Create;
end;
destructor TDFMConverter.Destroy;
begin
inherited Destroy;
end;
function TDFMConverter.Convert(const DfmFilename: string): TModalResult;
var
s: String;
Urgency: TMessageLineUrgency;
begin
Result:=ConvertDfmToLfm(DfmFilename);
if Result=mrOK then begin
if fOrigFormat=sofBinary then begin
s:=Format(lisFileSIsConvertedToTextFormat, [DfmFilename]);
Urgency:=mluHint;
end
else begin
s:=Format(lisFileSHasIncorrectSyntax, [DfmFilename]);
Urgency:=mluError;
end;
if Assigned(fSettings) then
fSettings.AddLogLine(Urgency, s, DfmFilename)
else
ShowMessage(s);
end;
end;
function TDFMConverter.GetLFMFilename(const DfmFilename: string;
KeepCase: boolean): string;
begin
if DfmFilename<>'' then begin
// platform and fpc independent unitnames are lowercase, so are the lfm files
Result:=lowercase(ExtractFilenameOnly(DfmFilename));
if KeepCase then
Result:=ExtractFilenameOnly(DfmFilename);
Result:=ExtractFilePath(DfmFilename)+Result+'.lfm';
end else
Result:='';
end;
function TDFMConverter.FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
function FixWideString(aInStream, aOutStream: TMemoryStream): TModalResult;
// Convert Windows WideString syntax (#xxx) to UTF8
function UnicodeNumber(const InS: string; var Ind: integer): string;
@ -285,6 +236,40 @@ begin
aOutStream.Write(OutS[1], Length(OutS));
end;
{ TDFMConverter }
constructor TDFMConverter.Create;
begin
inherited Create;
end;
destructor TDFMConverter.Destroy;
begin
inherited Destroy;
end;
function TDFMConverter.Convert(const DfmFilename: string): TModalResult;
var
s: String;
Urgency: TMessageLineUrgency;
begin
Result:=ConvertDfmToLfm(DfmFilename);
if Result=mrOK then begin
if fOrigFormat=sofBinary then begin
s:=Format(lisFileSIsConvertedToTextFormat, [DfmFilename]);
Urgency:=mluHint;
end
else begin
s:=Format(lisFileSHasIncorrectSyntax, [DfmFilename]);
Urgency:=mluError;
end;
if Assigned(fSettings) then
fSettings.AddLogLine(Urgency, s, DfmFilename)
else
ShowMessage(s);
end;
end;
function TDFMConverter.ConvertDfmToLfm(const aFilename: string): TModalResult;
var
DFMStream, LFMStream, Utf8LFMStream: TMemoryStreamUTF8;