Page 1 of 1

Variant conversion Fail for Int64/LargeInt

Posted: 03.04.2012, 16:55
by aagusti
We know VInteger defined as Int64 but after I search at Unit ZVariant.pas Starting at Line 1081 convertion for Vint From String and attach using Integer conversion

Code: Select all

  vtInteger:
      case Value.VType of
        vtNull:
          Result.VInteger := 0;
        vtBoolean:
          if Value.VBoolean then
            Result.VInteger := 1
          else Result.VInteger := 0;
        vtInteger:
          Result.VInteger := Value.VInteger;
        vtFloat:
          Result.VInteger := Trunc(Value.VFloat);
        vtString:
          Result.VInteger :=  StrToInt64Def(Value.VString, 0); //StrToIntDef(Value.VString, 0);
        vtUnicodeString:
          Result.VInteger :=  StrToInt64Def(Value.VUnicodeString, 0);//StrToIntDef(Value.VUnicodeString, 0);
        vtDateTime:
          Result.VInteger := Trunc(Value.VDateTime);
        vtPointer:
          Result.VInteger := Int64(Value.VPointer);//Integer(Value.VPointer);
        vtInterface:
          RaiseTypeMismatchError;
      end;
CMIIW

Posted: 25.04.2012, 22:17
by mdaems
We know VInteger defined as Int64 but after I search at Unit ZVariant.pas Starting at Line 1081 convertion for Vint From String and attach using Integer conversion
Is this also true on 32 bit compilers? And isn't the conversion Integer() working correctly in 64 compilers?

Mark

Posted: 25.04.2012, 22:26
by EgonHugeist
Still done, Mark.

Don't know the Rev. anymore. In meanwhile this patch should be in the trunk too.

Michael

Posted: 25.04.2012, 23:33
by mdaems
Yes, but we're talking about the 6.6-patches branch here... Is it applicable there too?

Mark

Posted: 25.04.2012, 23:44
by EgonHugeist
Nope, you're right..

We need this in 6.6.6 too