Ver código fonte

* correctly handle DataSize for ShortString

git-svn-id: trunk@36988 -
svenbarth 8 anos atrás
pai
commit
9dff6043d9
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      packages/rtl-objpas/src/inc/rtti.pp

+ 3 - 2
packages/rtl-objpas/src/inc/rtti.pp

@@ -614,7 +614,7 @@ function TValue.GetDataSize: SizeInt;
 begin
   if IsEmpty then
     Result := 0
-  else if Assigned(FData.FValueData) then
+  else if Assigned(FData.FValueData) and (Kind <> tkSString) then
     Result := FData.FValueData.GetDataSize
   else begin
     Result := 0;
@@ -660,7 +660,8 @@ begin
         { ? }
         Result := SizeOf(TMethod);
       tkSString:
-        Result := SizeOf(ShortString);
+        { ShortString can hold max. 254 characters as [0] is Length and [255] is #0 }
+        Result := SizeOf(ShortString) - 2;
       tkVariant:
         Result := SizeOf(Variant);
       tkProcVar: