mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 06:07:29 +01:00
Jedi code format: cleanup, remove compiler hints.
This commit is contained in:
parent
5f520b62b9
commit
eacf519cbb
@ -120,12 +120,14 @@ const
|
||||
CurlyLeft = '{'; //widechar(123);
|
||||
CurlyRight = '}'; //widechar(125);
|
||||
|
||||
{$push}{$warn 5024 off}
|
||||
function CheckMultiByte(const pcChar: char): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
// if GetRegSettings.CheckMultiByteChars then
|
||||
// Result := IsMultiByte(pcChar); //IsMultiByte(pcChar)-->Result := IsDBCSLeadByte(Byte(pcChar));
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
function CharIsOctDigit(const c: Char): Boolean;
|
||||
const
|
||||
|
||||
@ -194,7 +194,7 @@ const
|
||||
MethodHeadings: TParseTreeNodeTypeSet =
|
||||
[nFunctionHeading, nProcedureHeading, nConstructorHeading, nDestructorHeading];
|
||||
|
||||
function NodeTypeToString(const pe: TParseTreeNodeType): string; inline;
|
||||
function NodeTypeToString(const pe: TParseTreeNodeType): string;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@ -69,6 +69,8 @@ uses
|
||||
SourceToken, FormatFlags, JcfSettings, SetReturns,
|
||||
TokenUtils, JcfMiscFunctions, Tokens, ParseTreeNodeType;
|
||||
|
||||
{$WARN 6058 off} // supress note: function/procedure marked as inline is not inlined
|
||||
|
||||
function IsLineBreaker(const pcToken: TSourceToken): boolean;
|
||||
begin
|
||||
Result := (pcToken.TokenType in [ttReturn, ttConditionalCompilationRemoved]) or
|
||||
|
||||
@ -81,9 +81,6 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
MAX_TOKENS = 100000;
|
||||
|
||||
{ TCodeWriter }
|
||||
|
||||
constructor TCodeWriter.Create;
|
||||
|
||||
@ -495,8 +495,10 @@ var
|
||||
begin
|
||||
//WRAPPING the inputCode in a fake unit
|
||||
sourceCodeLowerCase := LowerCase(fsInputCode);
|
||||
{$push}{$warn 5057 off}
|
||||
hasInterface := HasStringAtLineStart(sourceCodeLowerCase, 'interface', liInterfacePos);
|
||||
hasImplementation := HasStringAtLineStart(sourceCodeLowerCase, 'implementation', liImplementationPos);
|
||||
{$pop}
|
||||
sourceCode := '';
|
||||
AddFakeUnit;
|
||||
if hasInterface = False then
|
||||
|
||||
@ -30,9 +30,7 @@ See http://www.gnu.org/licenses/gpl.html
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{ local }
|
||||
Converter;
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
TStringsConverter = class(TObject)
|
||||
@ -44,10 +42,10 @@ type
|
||||
|
||||
protected
|
||||
function OriginalFileName: string;
|
||||
|
||||
{$push}{$warn 5024 off}
|
||||
procedure SendStatusMessage(const psFile, psMessage: string;
|
||||
const piY, piX: integer);
|
||||
|
||||
{$pop}
|
||||
public
|
||||
constructor Create;
|
||||
|
||||
@ -90,6 +88,7 @@ begin
|
||||
fcMessageStrings := pcStrings;
|
||||
end;
|
||||
|
||||
{$push}{$warn 5024 off}
|
||||
procedure TStringsConverter.SendStatusMessage(const psFile, psMessage: string;
|
||||
const piY, piX: integer);
|
||||
var
|
||||
@ -101,11 +100,9 @@ begin
|
||||
if (piY >= 0) and (piX >= 0) then
|
||||
lsWholeMessage := lsWholeMessage + ' at line ' + IntToStr(piY) +
|
||||
' col ' + IntToStr(piX);
|
||||
|
||||
|
||||
fcMessageStrings.Add(lsWholeMessage);
|
||||
end;
|
||||
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
end.
|
||||
|
||||
@ -56,8 +56,9 @@ type
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure OpenSection(const psName: string); override;
|
||||
{$push}{$warn 5024 off}
|
||||
procedure CloseSection(const psName: string); override;
|
||||
|
||||
{$pop}
|
||||
procedure Write(const psTagName, psValue: string); override;
|
||||
procedure Write(const psTagName: string; const piValue: integer); override;
|
||||
procedure Write(const psTagName: string; const pbValue: boolean); override;
|
||||
@ -122,10 +123,12 @@ begin
|
||||
fsSection := psName;
|
||||
end;
|
||||
|
||||
{$push}{$warn 5024 off}
|
||||
procedure TSettingsRegistryOutput.CloseSection(const psName: string);
|
||||
begin
|
||||
fsSection := '';
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
procedure TSettingsRegistryOutput.Write(const psTagName, psValue: string);
|
||||
begin
|
||||
|
||||
@ -58,6 +58,8 @@ implementation
|
||||
|
||||
{ TIntList }
|
||||
|
||||
{$WARN 6058 off} // supress note: function/procedure marked as inline is not inlined
|
||||
|
||||
procedure TIntList.ChangeValue(const liIndex, liDelta: integer);
|
||||
begin
|
||||
{ can fall out of bounds, easiest to ignore it here }
|
||||
|
||||
@ -313,12 +313,14 @@ begin
|
||||
Result := Length(AString) - (Pos1 + Length(NativeLineBreak));
|
||||
end;
|
||||
|
||||
{$push}{$warn 5091 off}
|
||||
function ReadFileToUTF8String(AFilename: string): string;
|
||||
var
|
||||
lMs: TMemorystream;
|
||||
lS: string;
|
||||
begin
|
||||
lMs := TMemoryStream.Create;
|
||||
Result := '';
|
||||
try
|
||||
lMs.LoadFromFile(AFileName);
|
||||
SetLength(lS, lMs.Size);
|
||||
@ -328,5 +330,6 @@ begin
|
||||
lMs.Free;
|
||||
end;
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
end.
|
||||
|
||||
@ -126,7 +126,7 @@ function StrCharCount(const S: string; C: Char): Integer;
|
||||
function StrStrCount(const S, SubS: string): Integer;
|
||||
function StrRepeat(const S: string; Count: Integer): string;
|
||||
procedure StrReplace(var S: string; const Search, Replace: string; Flags: TReplaceFlags = []);
|
||||
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer; inline;
|
||||
function StrSearch(const Substr, S: string; const Index: Integer = 1): Integer; inline; deprecated 'Use Pos instead';
|
||||
function StrFind(const Substr, S: string; const Index: Integer = 1): Integer;
|
||||
|
||||
function BooleanToStr(B: Boolean): string;
|
||||
@ -294,7 +294,7 @@ function StrAfter(const SubStr, S: string): string;
|
||||
var
|
||||
P: Integer;
|
||||
begin
|
||||
P := StrSearch(SubStr, S, 1);
|
||||
P := Pos(SubStr, S, 1);
|
||||
if P > 0 then
|
||||
Result := Copy(S, P + Length(SubStr), Length(S))
|
||||
else
|
||||
@ -305,7 +305,7 @@ function StrBefore(const SubStr, S: string): string;
|
||||
var
|
||||
P: Integer;
|
||||
begin
|
||||
P := StrSearch(SubStr, S, 1);
|
||||
P := Pos(SubStr, S, 1);
|
||||
if P > 0 then
|
||||
Result := Copy(S, 1, P - 1)
|
||||
else
|
||||
@ -324,7 +324,7 @@ begin
|
||||
Result := 0;
|
||||
while Result < Length(S) do
|
||||
begin
|
||||
NewPos := StrSearch(SubStr, S, Result + 1);
|
||||
NewPos := Pos(SubStr, S, Result + 1);
|
||||
if NewPos > 0 then
|
||||
Result := NewPos
|
||||
else
|
||||
@ -383,7 +383,7 @@ begin
|
||||
P := 1;
|
||||
while P < Length(S) do
|
||||
begin
|
||||
P := StrSearch(Subs, S, P);
|
||||
P := Pos(Subs, S, P);
|
||||
if P > 0 then
|
||||
begin
|
||||
inc(Result);
|
||||
@ -480,6 +480,7 @@ var
|
||||
S: TStream;
|
||||
begin
|
||||
S := nil;
|
||||
Result := '';
|
||||
try
|
||||
S := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
|
||||
SetLength(Result, S.Size);
|
||||
@ -502,12 +503,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$push}{$warn 5094 off}
|
||||
function StrFillChar(const C: Char; Count: Integer): string;
|
||||
begin
|
||||
SetLength(Result, Count);
|
||||
if Count > 0 then
|
||||
FillChar(Result[1], Count, C);
|
||||
end;
|
||||
{$pop}
|
||||
|
||||
function IntToStrZeroPad(Value, Count: Integer): String;
|
||||
begin
|
||||
|
||||
@ -161,6 +161,7 @@ var
|
||||
liBytesRemaining: integer;
|
||||
lsContents8bit: AnsiString;
|
||||
begin
|
||||
{$push}{$warn 5091 off}
|
||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||
// read the bytes into a string
|
||||
SetLength(lsContents8bit, liBytesRemaining);
|
||||
@ -169,6 +170,7 @@ begin
|
||||
pcFileStream.ReadBuffer(lsContents8bit[1], liBytesRemaining);
|
||||
end;
|
||||
Result := lsContents8bit;
|
||||
{$pop}
|
||||
end;
|
||||
|
||||
|
||||
@ -177,7 +179,8 @@ var
|
||||
liBytesRemaining: integer;
|
||||
lsContents: AnsiString;
|
||||
begin
|
||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||
{$push}{$warn 5091 off}
|
||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||
// read the bytes into a string
|
||||
SetLength(lsContents, liBytesRemaining);
|
||||
if pcFileStream.Size > 0 then
|
||||
@ -185,6 +188,7 @@ begin
|
||||
pcFileStream.ReadBuffer(lsContents[1], liBytesRemaining);
|
||||
end;
|
||||
Result := lsContents;
|
||||
{$pop}
|
||||
end;
|
||||
|
||||
|
||||
@ -194,6 +198,7 @@ var
|
||||
liLoop: integer;
|
||||
lsWideContents: WideString;
|
||||
begin
|
||||
{$push}{$warn 5091 off}
|
||||
// read it
|
||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||
SetLength(lsWideContents, liBytesRemaining div 2);
|
||||
@ -207,6 +212,7 @@ begin
|
||||
end;
|
||||
|
||||
Result := lsWideContents;
|
||||
{$pop}
|
||||
end;
|
||||
|
||||
function SwapWords(const value: UCS4Char): UCS4Char;
|
||||
@ -232,6 +238,7 @@ var
|
||||
ucs4Chars: UCS4String;
|
||||
liLoop: integer;
|
||||
begin
|
||||
{$push}{$warn 5091 off}
|
||||
liBytesRemaining := pcFileStream.Size - pcFileStream.Position;
|
||||
charsRemaining := liBytesRemaining div 4;
|
||||
|
||||
@ -246,6 +253,7 @@ begin
|
||||
end;
|
||||
|
||||
Result := UCS4StringToWideString(ucs4Chars);
|
||||
{$pop}
|
||||
end;
|
||||
|
||||
{ read in a text file,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user