* fix regression introduced with r42240: packed sets for the Integer based variants of SetToString/StringToSet need to be shifted on Big Endian systems

git-svn-id: trunk@43048 -
This commit is contained in:
svenbarth 2019-09-21 14:36:19 +00:00
parent e4c275a349
commit a00be912aa

View File

@ -1196,11 +1196,18 @@ end;
Function SetToString(PropInfo: PPropInfo; Value: LongInt; Brackets: Boolean) : String;
begin
Result:=SetToString(PropInfo^.PropType, @Value, Brackets);
Result:=SetToString(PropInfo^.PropType, Value, Brackets);
end;
Function SetToString(TypeInfo: PTypeInfo; Value: LongInt; Brackets: Boolean) : String;
begin
{$if defined(FPC_BIG_ENDIAN)}
{ correctly adjust packed sets that are smaller than 32-bit }
case GetTypeData(TypeInfo)^.OrdType of
otSByte,otUByte: Value := Value shl (SizeOf(Integer)*8-8);
otSWord,otUWord: Value := Value shl (SizeOf(Integer)*8-16);
end;
{$endif}
Result := SetToString(TypeInfo, @Value, Brackets);
end;
@ -1295,12 +1302,19 @@ end;
Function StringToSet(PropInfo: PPropInfo; const Value: string): LongInt;
begin
StringToSet(PropInfo^.PropType,Value,@Result);
Result:=StringToSet(PropInfo^.PropType,Value);
end;
Function StringToSet(TypeInfo: PTypeInfo; const Value: string): LongInt;
begin
StringToSet(TypeInfo, Value, @Result);
{$if defined(FPC_BIG_ENDIAN)}
{ correctly adjust packed sets that are smaller than 32-bit }
case GetTypeData(TypeInfo)^.OrdType of
otSByte,otUByte: Result := Result shr (SizeOf(Integer)*8-8);
otSWord,otUWord: Result := Result shr (SizeOf(Integer)*8-16);
end;
{$endif}
end;
procedure StringToSet(TypeInfo: PTypeInfo; const Value: String; Result: Pointer);