joaorobertoct2 / x-superobject

Automatically exported from code.google.com/p/x-superobject
0 stars 0 forks source link

bug int64 value #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
var
  nValue:Int64;
  Obj:ISuperObject;
begin
   nValue:=1000000000000;
  Obj:=TSuperObject.Create;
  Obj.I['Value']:=nValue;
  Memo1.Lines.Add(Format('Value=%d',[nValue]));
  Memo1.Lines.Add(Obj.AsJSON(True));
  Obj:=nil;
end;

result

Value=1000000000000
{
  "Value":  -727379968
}

Original issue reported on code.google.com by wity...@gmail.com on 2 Mar 2015 at 5:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
this patch work fine.

--- XSuperObject.bak    2015-01-03 09:24:21.915882500 +0700
+++ XSuperObject.pas    2015-03-09 22:53:12.000000000 +0700
@@ -696,7 +696,7 @@
   if TJSONString.InheritsFrom(TT) then
     Result := TJSONString.Create(String(Value)) as TT
   else if TJSONInteger.InheritsFrom(TT) then
-    Result := TJSONInteger.Create(Integer(Value)) as TT
+    Result := TJSONInteger.Create(Int64(Value)) as TT
   else if TJSONFloat.InheritsFrom(TT) then
     Result := TJSONFloat.Create(Double(Value)) as TT
   else if TJSONBoolean.InheritsFrom(TT) then

Original comment by wity...@gmail.com on 9 Mar 2015 at 4:07

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r89.

Original comment by onryld...@gmail.com on 10 Mar 2015 at 10:20