Skip to content

Commit e18b3db

Browse files
committed
fix: a few more compiler hints and warnings
1 parent f88405b commit e18b3db

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

source/apphelpers.pas

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,7 @@ procedure OpenTextFile(const Filename: String; out Stream: TFileStream; var Enco
13391339
// If the file contains a BOM, advance the stream's position
13401340
BomLen := 0;
13411341
if Length(Encoding.GetPreamble) > 0 then begin
1342+
Header := [];
13421343
SetLength(Header, Length(Encoding.GetPreamble));
13431344
Stream.ReadBuffer(Pointer(Header)^, Length(Header));
13441345
if CompareMem(Header, Encoding.GetPreamble, SizeOf(Header)) then
@@ -1369,7 +1370,7 @@ function DetectEncoding(Stream: TStream): TEncoding;
13691370
OldPos := Stream.Position;
13701371
Stream.Position := 0;
13711372
try
1372-
ReadCount := Stream.Read(Buffer, SizeOf(Buffer));
1373+
ReadCount := Stream.Read({%H-}Buffer, SizeOf(Buffer));
13731374
finally
13741375
Stream.Position := OldPos;
13751376
end;
@@ -1401,6 +1402,7 @@ function ReadTextfileChunk(Stream: TFileStream; Encoding: TEncoding; ChunkSize:
14011402
if (ChunkSize = 0) or (ChunkSize > DataLeft) then
14021403
ChunkSize := DataLeft;
14031404

1405+
Bytes := [];
14041406
SetLength(Bytes, ChunkSize);
14051407
Stream.ReadBuffer(Bytes[0], Length(Bytes));
14061408
Result := Encoding.GetAnsiString(Bytes);
@@ -2798,6 +2800,7 @@ function IsPortFree(APort: Word; const AIP: string = '127.0.0.1'): Boolean;
27982800
Exit;
27992801

28002802
try
2803+
addr := Default(TInetSockAddr);
28012804
FillChar(addr, SizeOf(addr), 0);
28022805
addr.sin_family := AF_INET;
28032806
addr.sin_port := htons(APort);
@@ -3023,7 +3026,7 @@ procedure CopyImageList(SourceList, TargetList: TImageList; AppendDisabled: Bool
30233026
TargetList.RegisterResolutions(Resolutions);
30243027
for i:=0 to SourceList.Count-1 do
30253028
begin
3026-
SetLength(TempBitmapList, 0);
3029+
TempBitmapList := [];
30273030
SetLength(TempBitmapList, Length(Resolutions));
30283031
for ResIdx:=Low(Resolutions) to High(Resolutions) do begin
30293032
ResWidth := Resolutions[ResIdx];

source/connections.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ procedure Tconnform.ListSessionsDragDrop(Sender: TBaseVirtualTree;
939939
else
940940
ParentNode := TargetNode;
941941

942+
ParentKey := '';
942943
SiblingSessions := NodeSessionNames(ParentNode, ParentKey);
943944
// Test if target folder has an equal named node
944945
if SiblingSessions.IndexOf(FocusedSess.SessionName) > -1 then

source/dbconnection.pas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ function TSecureShellCmd.ReadPipe(const Pipe: TInputPipeStream): String;
12591259
BytesAvailable := Pipe.NumBytesAvailable;
12601260
if BytesAvailable = 0 then
12611261
Break;
1262+
Buffer := '';
12621263
SetLength(Buffer, BytesAvailable);
12631264
BytesRead := Pipe.Read(Buffer[1], BytesAvailable);
12641265
Result := Result + Copy(Buffer, 1, BytesRead);
@@ -8992,6 +8993,7 @@ function TDBQuery.ColumnExists(ColumnName: String): Boolean;
89928993

89938994
function TDBQuery.GetColBinData(Column: Integer; var baData: TBytes): Boolean;
89948995
begin
8996+
Result := False;
89958997
Raise EDbError.Create(SNotImplemented);
89968998
end;
89978999

source/main.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4335,7 +4335,7 @@ procedure TMainForm.DataGridContextPopup(Sender: TObject; MousePos: TPoint;
43354335
HitInfo: THitInfo;
43364336
begin
43374337
// Prevent context popup if clicked on header, or click was not on a node
4338-
(Sender as TLazVirtualStringTree).GetHitTestInfoAt(MousePos.X, MousePos.Y, True, HitInfo);
4338+
(Sender as TLazVirtualStringTree).GetHitTestInfoAt(MousePos.X, MousePos.Y, True, {%H-}HitInfo);
43394339
Handled := (HitInfo.HitNode = nil);
43404340
end;
43414341

@@ -5281,7 +5281,7 @@ procedure TMainForm.actDataInsertExecute(Sender: TObject);
52815281
if (Sender = actDataDuplicateRowWithoutKeys) or (Sender = actDataDuplicateRowWithKeys) then
52825282
DupeNode := Grid.FocusedNode;
52835283
RowNum := Results.InsertRow;
5284-
NewNode := Grid.InsertNode(Grid.FocusedNode, amInsertAfter, PInt64(RowNum));
5284+
NewNode := Grid.InsertNode(Grid.FocusedNode, amInsertAfter, {%H-}PInt64(RowNum));
52855285
SelectNode(Grid, NewNode);
52865286
if Assigned(DupeNode) then begin
52875287
// Copy values from source row, ensure we have whole cell data
@@ -6686,7 +6686,7 @@ procedure TMainForm.SynCompletionProposalExecute(Sender: TObject);
66866686
Param: TRoutineParam;
66876687
DisplayText: String;
66886688
SQLFunc: TSQLFunction;
6689-
DummyPos: Integer;
6689+
DummyPos: Integer=0;
66906690

66916691
procedure AddTable(Obj: TDBObject);
66926692
var

0 commit comments

Comments
 (0)