* Fix compiler warnings and hints

This commit is contained in:
Michaël Van Canneyt 2024-12-17 18:17:12 +01:00
parent cc6aabaf8b
commit 4a596a2de3

View File

@ -587,13 +587,14 @@ type
FHandle : PExtendedFieldEntry; FHandle : PExtendedFieldEntry;
FAttributes: TCustomAttributeArray; FAttributes: TCustomAttributeArray;
FAttributesResolved : Boolean; FAttributesResolved : Boolean;
function GetName: string; override;
function GetDataType: TRttiType; override; function GetDataType: TRttiType; override;
function GetIsReadable: Boolean; override; function GetIsReadable: Boolean; override;
function GetIsWritable: Boolean; override; function GetIsWritable: Boolean; override;
procedure ResolveAttributes;
protected
function GetName: string; override;
function GetHandle: Pointer; override; function GetHandle: Pointer; override;
Function GetAttributes: TCustomAttributeArray; override; Function GetAttributes: TCustomAttributeArray; override;
procedure ResolveAttributes;
// constructor Create(AParent: TRttiObject; var P: PByte); override; // constructor Create(AParent: TRttiObject; var P: PByte); override;
public public
destructor destroy; override; destructor destroy; override;
@ -2377,6 +2378,14 @@ begin
result := ATypeInfo = TypeInfo; result := ATypeInfo = TypeInfo;
end; end;
function TValue.GetIsEmpty: boolean;
begin
result := (FData.FTypeInfo=nil) or
((Kind in [tkSString, tkObject, tkRecord, tkArray]) and not Assigned(FData.FValueData)) or
((Kind in [tkClass, tkClassRef, tkInterfaceRaw]) and not Assigned(FData.FAsPointer));
end;
function TValue.IsType(ATypeInfo: PTypeInfo; const EmptyAsAnyType : Boolean): boolean; function TValue.IsType(ATypeInfo: PTypeInfo; const EmptyAsAnyType : Boolean): boolean;
begin begin
Result:=IsEmpty; Result:=IsEmpty;
@ -3816,12 +3825,6 @@ begin
end; end;
function TValue.GetIsEmpty: boolean;
begin
result := (FData.FTypeInfo=nil) or
((Kind in [tkSString, tkObject, tkRecord, tkArray]) and not Assigned(FData.FValueData)) or
((Kind in [tkClass, tkClassRef, tkInterfaceRaw]) and not Assigned(FData.FAsPointer));
end;
function TValue.IsArray: boolean; function TValue.IsArray: boolean;
begin begin
@ -4521,6 +4524,7 @@ var
hiddenVmt : Pointer; hiddenVmt : Pointer;
highArg: SizeInt; highArg: SizeInt;
begin begin
castedargs:=[];
mgr := FuncCallMgr[aCallConv]; mgr := FuncCallMgr[aCallConv];
if not Assigned(mgr.Invoke) then if not Assigned(mgr.Invoke) then
raise EInvocationError.CreateFmt(SErrCallConvNotSupported, [CCToStr(aCallConv)]); raise EInvocationError.CreateFmt(SErrCallConvNotSupported, [CCToStr(aCallConv)]);
@ -5604,9 +5608,7 @@ end;
{ TRttiIndexedProperty } { TRttiIndexedProperty }
procedure TRttiIndexedProperty.GetAccessors; procedure TRttiIndexedProperty.GetAccessors;
var
context: TRttiContext;
obj: TRttiObject;
begin begin
if Assigned(FReadMethod) or Assigned(FWriteMethod) or if Assigned(FReadMethod) or Assigned(FWriteMethod) or
not IsReadable and not IsWritable then not IsReadable and not IsWritable then
@ -5724,6 +5726,7 @@ var
argsV: TValueArray; argsV: TValueArray;
i: Integer; i: Integer;
begin begin
argsV:=[];
setter := WriteMethod; setter := WriteMethod;
if setter = nil then if setter = nil then
raise EPropertyError.CreateFmt(SErrCannotWriteToIndexedProperty, [Name]); raise EPropertyError.CreateFmt(SErrCannotWriteToIndexedProperty, [Name]);
@ -6241,12 +6244,11 @@ Procedure TRttiInstanceType.ResolveExtendedDeclaredProperties;
var var
Table: PPropDataEx; Table: PPropDataEx;
//List : PPropListEx; //List : PPropListEx;
Ctx: TRttiContext;
info : PPropInfoEx; info : PPropInfoEx;
TP : PPropInfo; TP : PPropInfo;
Prop : TRttiProperty; Prop : TRttiProperty;
i,j,Idx,IdxCount,Len, PropCount : Integer; i,j,Len, PropCount : Integer;
obj: TRttiObject;
begin begin
Table:=PClassData(FTypeData)^.ExRTTITable; Table:=PClassData(FTypeData)^.ExRTTITable;
Len:=Table^.PropCount; Len:=Table^.PropCount;
@ -6286,12 +6288,8 @@ Procedure TRttiInstanceType.ResolveClassicDeclaredProperties;
var var
Table: PPropData; Table: PPropData;
lTypeInfo: PTypeInfo;
TypeRttiType: TRttiType;
TD: PTypeData;
TP: PPropInfo; TP: PPropInfo;
Idx,I,Len: longint; I,Len: longint;
Prop: TRttiProperty; Prop: TRttiProperty;
begin begin
@ -6333,12 +6331,11 @@ Procedure TRttiInstanceType.ResolveDeclaredIndexedProperties;
var var
Table: PPropDataEx; Table: PPropDataEx;
Ctx: TRttiContext;
info : PPropInfoEx; info : PPropInfoEx;
TP : PPropInfo; TP : PPropInfo;
IProp : TRttiIndexedProperty; IProp : TRttiIndexedProperty;
i,j,Idx,IdxCount,Len, PropCount : Integer; i,Len, PropCount : Integer;
obj: TRttiObject;
begin begin
Table:=PClassData(FTypeData)^.ExRTTITable; Table:=PClassData(FTypeData)^.ExRTTITable;
Len:=Table^.PropCount; Len:=Table^.PropCount;
@ -6640,7 +6637,6 @@ var
TP : PPropInfo; TP : PPropInfo;
IProp : TRttiIndexedProperty; IProp : TRttiIndexedProperty;
i,Len, PropCount : Integer; i,Len, PropCount : Integer;
obj: TRttiObject;
begin begin
List:=Nil; List:=Nil;
@ -7121,7 +7117,6 @@ end;
destructor TRttiField.destroy; destructor TRttiField.destroy;
var var
Attr : TCustomAttribute;
I : Integer; I : Integer;
begin begin
@ -7620,7 +7615,7 @@ end;
class function TRttiContext.Create(aUsePublishedOnly: Boolean): TRttiContext; class function TRttiContext.Create(aUsePublishedOnly: Boolean): TRttiContext;
begin begin
Result:=Create; Result:=Create();
Result.UsePublishedOnly:=aUsePublishedOnly; Result.UsePublishedOnly:=aUsePublishedOnly;
end; end;