From 17a99be262c15dfb1479cd2525ddaa401bc48ddc Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 8 Oct 2025 18:04:00 +0200 Subject: [PATCH] Fix a second bunch of compiler warnings and hints --- source/apphelpers.pas | 8 ++++---- source/connections.pas | 2 +- source/csv_detector.pas | 6 ++---- source/dbconnection.pas | 2 +- source/insertfiles.pas | 2 +- source/jsonregistry.pas | 2 +- source/lazaruscompat.pas | 16 ++++++++-------- source/loaddata.pas | 1 - source/main.pas | 12 +++++------- source/table_editor.pas | 4 ++-- source/trigger_editor.pas | 2 -- 11 files changed, 25 insertions(+), 32 deletions(-) diff --git a/source/apphelpers.pas b/source/apphelpers.pas index 510dd6c1..7c579b9e 100644 --- a/source/apphelpers.pas +++ b/source/apphelpers.pas @@ -264,7 +264,7 @@ type procedure SetSessionPath(Value: String); procedure PrepareRegistry; procedure Read(Index: TAppSettingIndex; FormatName: String; - DataType: TAppSettingDataType; var I: Integer; var B: Boolean; var S: String; + DataType: TAppSettingDataType; out I: Integer; out B: Boolean; out S: String; DI: Integer; DB: Boolean; DS: String); procedure Write(Index: TAppSettingIndex; FormatName: String; DataType: TAppSettingDataType; I: Integer; B: Boolean; S: String); @@ -2840,12 +2840,12 @@ var begin {$IfDef LINUX} // Netcat on Linux - CmdResult := RunCommand('nc -w 1 -zv 127.0.0.1 '+Port.ToString, Output); + CmdResult := Process.RunCommandInDir('', 'nc', ['-w 1 -zv 127.0.0.1 '+Port.ToString], Output); Result := not CmdResult; {$EndIf} {$IfDef WINDOWS} // netstat on Windows - CmdResult := RunCommand('netstat -na -p TCP', Output); + CmdResult := Process.RunCommandInDir('', 'netstat', ['-na -p TCP'], Output); Result := (not CmdResult) or (not Output.Contains(':' + Port.ToString + ' ')); {$EndIf} end; @@ -4209,7 +4209,7 @@ end; procedure TAppSettings.Read(Index: TAppSettingIndex; FormatName: String; - DataType: TAppSettingDataType; var I: Integer; var B: Boolean; var S: String; + DataType: TAppSettingDataType; out I: Integer; out B: Boolean; out S: String; DI: Integer; DB: Boolean; DS: String); var ValueName: String; diff --git a/source/connections.pas b/source/connections.pas index 97928fcf..b879b337 100644 --- a/source/connections.pas +++ b/source/connections.pas @@ -1367,7 +1367,7 @@ begin Lib := TSQLiteLib.CreateWithMultipleCipherFunctions(LibraryPath, Params.DefaultLibrary); for i:=1 to Lib.sqlite3mc_cipher_count() do begin Item := TMenuItem.Create(FPopupCiphers); - Item.Caption := Utf8ToString(Lib.sqlite3mc_cipher_name(i)); + Item.Caption := AnsiToUtf8(Lib.sqlite3mc_cipher_name(i)); Item.OnClick := MenuCiphersClick; FPopupCiphers.Items.Add(Item); end; diff --git a/source/csv_detector.pas b/source/csv_detector.pas index 5735d53b..54301a9c 100644 --- a/source/csv_detector.pas +++ b/source/csv_detector.pas @@ -62,7 +62,7 @@ var GridRows: TGridRows; GridRow: TGridRow; GridValue: TGridValue; - Term, Encl, Escp, LineTerm: String; + Term, Encl, {Escp,} LineTerm: String; RowNum, IgnoreLines: Integer; P, ContentLen, ProgressCharsPerStep, ProgressChars: Integer; EnclLen, TermLen, LineTermLen: Integer; @@ -134,7 +134,7 @@ begin Term := FConnection.UnescapeString(FLoadDataFrm.editFieldTerminator.Text); Encl := FConnection.UnescapeString(FLoadDataFrm.editFieldEncloser.Text); LineTerm := FConnection.UnescapeString(FLoadDataFrm.editLineTerminator.Text); - Escp := FConnection.UnescapeString(FLoadDataFrm.editFieldEscaper.Text); + //Escp := FConnection.UnescapeString(FLoadDataFrm.editFieldEscaper.Text); RowNum := 0; TermLen := Length(Term); @@ -224,7 +224,6 @@ var i, j, k: Integer; UnknownTypeYet, IsInteger, IsFloat, IsDate, IsDatetime, IsText: Boolean; ValueSize, TypeSize: Int64; - FloatValue: Extended; LoopType: TDBDatatype; const FloatChars = ['0'..'9', '.']; @@ -263,7 +262,6 @@ begin IsInteger := IntToStr(StrToInt64Def(Value.OldText, -1)) = Value.OldText; - FloatValue := StrToFloatDef(Value.OldText, -1, MainForm.FormatSettings); IsFloat := Value.OldText.Contains('.'); if IsFloat then begin for k:=1 to Length(Value.OldText) do begin diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 48b1457f..23ae2c6b 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -1908,7 +1908,7 @@ begin ngMySQL, ngPgSQL, ngSQLite, ngInterbase: begin {$If defined(LINUX)} // See https://serverfault.com/a/513938 - Process.RunCommand('/sbin/ldconfig', ['-p'], LibMapOutput); + Process.RunCommandInDir('', '/sbin/ldconfig', ['-p'], LibMapOutput); LibMapLines := Explode(sLineBreak, LibMapOutput); for LibMap in LibMapLines do begin if rx.Exec(LibMap) then begin diff --git a/source/insertfiles.pas b/source/insertfiles.pas index f1c4d709..25a143f8 100644 --- a/source/insertfiles.pas +++ b/source/insertfiles.pas @@ -253,7 +253,7 @@ var begin // Handle click event Grid := Sender as TVirtualStringTree; - Grid.GetHitTestInfoAt(Mouse.CursorPos.X-Grid.ClientOrigin.X, Mouse.CursorPos.Y-Grid.ClientOrigin.Y, True, Click); + Grid.GetHitTestInfoAt(Mouse.CursorPos.X-Grid.ClientOrigin.X, Mouse.CursorPos.Y-Grid.ClientOrigin.Y, True, {%H-}Click); GridHandleClickOrKeyPress(Grid, Click.HitNode, Click.HitColumn, Click.HitPositions); end; diff --git a/source/jsonregistry.pas b/source/jsonregistry.pas index 52602333..90a12a73 100644 --- a/source/jsonregistry.pas +++ b/source/jsonregistry.pas @@ -1,6 +1,6 @@ unit jsonregistry; -{$mode Delphi}{$H+} +{$mode delphi}{$H+} interface diff --git a/source/lazaruscompat.pas b/source/lazaruscompat.pas index 623ea5c4..bc5f9191 100644 --- a/source/lazaruscompat.pas +++ b/source/lazaruscompat.pas @@ -1,6 +1,6 @@ unit lazaruscompat; -{$mode Delphi} +{$mode delphi}{$H+} interface @@ -119,13 +119,13 @@ const (Value: ecSetMarker7; Name: 'ecSetMarker7'), (Value: ecSetMarker8; Name: 'ecSetMarker8'), (Value: ecSetMarker9; Name: 'ecSetMarker9'), - (Value: ecUpperCase; Name: 'ecUpperCase'), - (Value: ecLowerCase; Name: 'ecLowerCase'), - (Value: ecToggleCase; Name: 'ecToggleCase'), - (Value: ecTitleCase; Name: 'ecTitleCase'), - (Value: ecUpperCaseBlock; Name: 'ecUpperCaseBlock'), - (Value: ecLowerCaseBlock; Name: 'ecLowerCaseBlock'), - (Value: ecToggleCaseBlock; Name: 'ecToggleCaseBlock'), + (Value: {%H-}ecUpperCase; Name: 'ecUpperCase'), + (Value: {%H-}ecLowerCase; Name: 'ecLowerCase'), + (Value: {%H-}ecToggleCase; Name: 'ecToggleCase'), + (Value: {%H-}ecTitleCase; Name: 'ecTitleCase'), + (Value: {%H-}ecUpperCaseBlock; Name: 'ecUpperCaseBlock'), + (Value: {%H-}ecLowerCaseBlock; Name: 'ecLowerCaseBlock'), + (Value: {%H-}ecToggleCaseBlock; Name: 'ecToggleCaseBlock'), //(Value: ecTitleCaseBlock; Name: 'ecTitleCaseBlock'), {$IFDEF SYN_CodeFolding} (Value: ecString; Name:'ecString'), diff --git a/source/loaddata.pas b/source/loaddata.pas index 74f81c9c..5777512e 100644 --- a/source/loaddata.pas +++ b/source/loaddata.pas @@ -667,7 +667,6 @@ end; procedure Tloaddataform.btnOpenFileClick(Sender: TObject); var Dialog: TExtFileOpenDialog; - TestStream: TFileStream; begin AppSettings.ResetPath; Dialog := TExtFileOpenDialog.Create(Self); diff --git a/source/main.pas b/source/main.pas index 5b79aaf1..c72c280f 100644 --- a/source/main.pas +++ b/source/main.pas @@ -3934,7 +3934,7 @@ end; // Load SQL-file, make sure that SheetQuery is activated procedure TMainForm.actLoadSQLExecute(Sender: TObject); var - i, ProceedResult: Integer; + i: Integer; Dialog: TExtFileOpenDialog; Encoding: TEncoding; Tab: TQueryTab; @@ -5724,7 +5724,7 @@ var const NumSortChars: Array of String = ['¹','²','³','⁴','⁵','⁶','⁷','⁸','⁹','⁺']; - procedure GetSortIndex(Column: TVirtualTreeColumn; var SortIndex: Integer; var SortDirection: laz.VirtualTrees.TSortDirection); + procedure GetSortIndex(Column: TVirtualTreeColumn; out SortIndex: Integer; out SortDirection: laz.VirtualTrees.TSortDirection); var SortItem: TSortItem; begin @@ -6756,11 +6756,9 @@ var i, j, ImageIndex, ColumnsInList: Integer; Results: TDBQuery; DBObjects: TDBObjectList; - CurrentQuery, TableClauses, TableName, LeftPart, Token1, Token2, Token3, Token, Ident: String; + CurrentQuery, TableClauses, TableName, LeftPart, Token1, Token2, Ident: String; Tables: TStringList; rx: TRegExpr; - Start, TokenTypeInt: Integer; - Attri: TSynHighlighterAttributes; Proposal: TSynCompletion; Editor: TCustomSynEdit; Queries: TSQLBatch; @@ -6868,7 +6866,7 @@ begin if rx.Exec(LeftPart) then begin Token1 := Conn.DeQuoteIdent(rx.Match[2]); Token2 := Conn.DeQuoteIdent(rx.Match[3]); - Token3 := Conn.DeQuoteIdent(rx.Match[4]); + //Token3 := Conn.DeQuoteIdent(rx.Match[4]); end; // Server variables, s'il vous plait? @@ -11271,7 +11269,7 @@ begin Grid := Sender as TVirtualStringTree; if not Assigned(Grid.FocusedNode) then Exit; - Grid.GetHitTestInfoAt(X, Y, False, Hit); + Grid.GetHitTestInfoAt(X, Y, False, {%H-}Hit); if (Hit.HitNode = nil) or (Hit.HitColumn = NoColumn) or (Hit.HitColumn = InvalidColumn) then begin Results := GridResult(Grid); if Results.Modified then begin diff --git a/source/table_editor.pas b/source/table_editor.pas index 21578cf1..79eb1042 100644 --- a/source/table_editor.pas +++ b/source/table_editor.pas @@ -1673,7 +1673,7 @@ var begin // Handle click event VT := Sender as TLazVirtualStringTree; - VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, Click); + VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, {%H-}Click); vtHandleClickOrKeyPress(VT, Click.HitNode, Click.HitColumn, Click.HitPositions); end; @@ -2064,7 +2064,7 @@ var begin // Handle click event VT := Sender as TLazVirtualStringTree; - VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, Click); + VT.GetHitTestInfoAt(Mouse.CursorPos.X-VT.ClientOrigin.X, Mouse.CursorPos.Y-VT.ClientOrigin.Y, True, {%H-}Click); if Assigned(Click.HitNode) and (Click.HitColumn > NoColumn) and (hiOnItemLabel in Click.HitPositions) then VT.EditNode(Click.HitNode, Click.HitColumn); end; diff --git a/source/trigger_editor.pas b/source/trigger_editor.pas index 9cfdc57a..c65a2b73 100644 --- a/source/trigger_editor.pas +++ b/source/trigger_editor.pas @@ -86,10 +86,8 @@ end; procedure TfrmTriggerEditor.Init(Obj: TDBObject); var - Definitions: TDBQuery; DBObjects: TDBObjectList; i: Integer; - Found: Boolean; Body, QuoteCharsRx, QuotedWordRx: String; rx: TRegExpr; begin