Skip to content

Commit dcace59

Browse files
committed
fix: Resolve compiler warnings and hints in PasBuild source
Add explicit string type casts for DOM API calls (UnicodeString/ AnsiString conversions), remove unused variables, and add reintroduce to constructors that hide inherited signatures.
1 parent 8f10de0 commit dcace59

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

src/main/pascal/PasBuild.Command.ProcessResources.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TProcessResourcesCommand = class(TBuildCommand)
3030
function ApplyFiltering(const AContent: string): string;
3131
procedure CopyResources(const ASourceDir, ATargetDir: string);
3232
public
33-
constructor Create(AConfig: TProjectConfig; AResourcesConfig: TResourcesConfig; const ATargetDir: string);
33+
constructor Create(AConfig: TProjectConfig; AResourcesConfig: TResourcesConfig; const ATargetDir: string); reintroduce;
3434

3535
function GetName: string; override;
3636
function Execute: Integer; override;

src/main/pascal/PasBuild.Command.ProcessTestResources.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TProcessTestResourcesCommand = class(TBuildCommand)
3030
function ApplyFiltering(const AContent: string): string;
3131
procedure CopyResources(const ASourceDir, ATargetDir: string);
3232
public
33-
constructor Create(AConfig: TProjectConfig; AResourcesConfig: TResourcesConfig; const ATargetDir: string);
33+
constructor Create(AConfig: TProjectConfig; AResourcesConfig: TResourcesConfig; const ATargetDir: string); reintroduce;
3434

3535
function GetName: string; override;
3636
function Execute: Integer; override;

src/main/pascal/PasBuild.Config.pas

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class function TConfigLoader.GetNodeText(AParent: TDOMNode; const ATagName: stri
5959
if not Assigned(AParent) then
6060
Exit;
6161

62-
Node := AParent.FindNode(ATagName);
62+
Node := AParent.FindNode(UnicodeString(ATagName));
6363
if Assigned(Node) and Assigned(Node.FirstChild) then
64-
Result := Trim(Node.TextContent);
64+
Result := Trim(string(Node.TextContent));
6565
end;
6666

6767
class procedure TConfigLoader.ParseDefines(AParent: TDOMNode; ADefines: TStringList);
@@ -83,7 +83,7 @@ class procedure TConfigLoader.ParseDefines(AParent: TDOMNode; ADefines: TStringL
8383
if (DefineNode.NodeType = ELEMENT_NODE) and (DefineNode.NodeName = 'define') then
8484
begin
8585
if Assigned(DefineNode.FirstChild) then
86-
ADefines.Add(Trim(DefineNode.TextContent));
86+
ADefines.Add(Trim(string(DefineNode.TextContent)));
8787
end;
8888
end;
8989
end;
@@ -107,7 +107,7 @@ class procedure TConfigLoader.ParseCompilerOptions(AParent: TDOMNode; AOptions:
107107
if (OptionNode.NodeType = ELEMENT_NODE) and (OptionNode.NodeName = 'option') then
108108
begin
109109
if Assigned(OptionNode.FirstChild) then
110-
AOptions.Add(Trim(OptionNode.TextContent));
110+
AOptions.Add(Trim(string(OptionNode.TextContent)));
111111
end;
112112
end;
113113
end;
@@ -123,7 +123,7 @@ class procedure TConfigLoader.ParseConditionalPaths(AParent: TDOMNode; const ATa
123123
if not Assigned(AParent) then
124124
Exit;
125125

126-
PathsNode := AParent.FindNode(ATagName);
126+
PathsNode := AParent.FindNode(UnicodeString(ATagName));
127127
if not Assigned(PathsNode) then
128128
Exit;
129129

@@ -135,7 +135,7 @@ class procedure TConfigLoader.ParseConditionalPaths(AParent: TDOMNode; const ATa
135135
begin
136136
if Assigned(PathNode.FirstChild) then
137137
begin
138-
PathValue := Trim(PathNode.TextContent);
138+
PathValue := Trim(string(PathNode.TextContent));
139139
if PathValue <> '' then
140140
begin
141141
// Get optional condition attribute
@@ -144,7 +144,7 @@ class procedure TConfigLoader.ParseConditionalPaths(AParent: TDOMNode; const ATa
144144
begin
145145
Element := TDOMElement(PathNode);
146146
if Element.HasAttribute('condition') then
147-
Condition := Trim(Element.GetAttribute('condition'));
147+
Condition := Trim(string(Element.GetAttribute('condition')));
148148
end;
149149

150150
ConditionalPath := TConditionalPath.Create(PathValue, Condition);
@@ -240,7 +240,7 @@ class procedure TConfigLoader.ParseTestSection(ATestNode: TDOMNode; AConfig: TPr
240240
if (OptionNode.NodeType = ELEMENT_NODE) and (OptionNode.NodeName = 'option') then
241241
begin
242242
if Assigned(OptionNode.FirstChild) then
243-
AConfig.TestConfig.FrameworkOptions.Add(Trim(OptionNode.TextContent));
243+
AConfig.TestConfig.FrameworkOptions.Add(Trim(string(OptionNode.TextContent)));
244244
end;
245245
end;
246246
end;
@@ -278,7 +278,7 @@ class procedure TConfigLoader.ParseSourcePackageSection(ASourcePackageNode: TDOM
278278
begin
279279
if Assigned(IncludeNode.FirstChild) then
280280
begin
281-
IncludeDir := Trim(IncludeNode.TextContent);
281+
IncludeDir := Trim(string(IncludeNode.TextContent));
282282
if IncludeDir <> '' then
283283
AConfig.SourcePackageConfig.IncludeDirs.Add(IncludeDir);
284284
end;
@@ -303,7 +303,7 @@ class procedure TConfigLoader.ParseModules(AModulesNode: TDOMNode; AModuleList:
303303
begin
304304
if Assigned(ModuleNode.FirstChild) then
305305
begin
306-
ModulePath := Trim(ModuleNode.TextContent);
306+
ModulePath := Trim(string(ModuleNode.TextContent));
307307
if ModulePath <> '' then
308308
AModuleList.Add(ModulePath);
309309
end;

src/main/pascal/PasBuild.ModuleDiscovery.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class function TModuleDiscoverer.DiscoverModules(const AAggregatorPath: string):
7272
J: Integer;
7373
DependencyPath: string;
7474
AbsoluteDependencyPath: string;
75-
DependencyModule: TModuleInfo;
7675
DependencyModuleInfo: TModuleInfo;
7776
begin
7877
Result := TModuleRegistry.Create;

src/main/pascal/PasBuild.Utils.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ class function TUtils.CollectSourceFiles(const ABaseDir: string): TStringList;
674674
class function TUtils.CollectIncludeFiles(const ABaseDir: string): TStringList;
675675
var
676676
SearchRec: TSearchRec;
677-
BasePath, FileName: string;
677+
BasePath: string;
678678
SubDirs: TStringList;
679679
SubDir: string;
680680
begin

0 commit comments

Comments
 (0)