[fpc-devel] TJSONDeStreamer can't handle such date format 'yyyy-MM-dd"T"hh:nn:ss"Z"'

Luiz Americo Pereira Camara luizamericop at gmail.com
Tue Jul 19 11:46:49 CEST 2016


2016-07-19 5:47 GMT-03:00 Michael Van Canneyt <michael at freepascal.org>:

>
>
> On Tue, 19 Jul 2016, Dimitrios Chr. Ioannidis wrote:
>
>     Exception class:   EAssertionFailedError
>>     Exception message: "Correct extended value" expected: <5,67> but was:
>> <6>
>>         at   $0043241F  TTESTJSONDESTREAMER__TESTFLOAT4,  line 374 of
>> testjsonrtti.pp
>>
>
> I am aware of this.
>
> However, this is only on i386, on 64-bit the code runs fine.
> I have no idea why, the code should be CPU agnostic.
>
> I have not yet had the opportunity to debug it on a i386 machine.
>

I just looked at it in this weekend.

After doing some tests and reading the docs i realized that is not a bug in
fpjsonrtti, nor a bug at all.

First write directly 4.56 to the property (of comp type). Reading it
directly gives a rounded value (5)

Than i read the docs:
http://www.freepascal.org/docs-html/ref/refsu6.html
"The Comp type is, in effect, a 64-bit integer and is not available on all
target platforms. To get more information on the supported types for each
platform, refer to the Programmer’s Guide. "

http://www.freepascal.org/docs-html/prog/progsu160.html#x204-2130008.2.5
"Comp

For Intel 80x86 processors, the comp type contains a 63-bit integral value,
and a sign bit (in the MSB position). The comp type uses 8 bytes of storage
space.

On other processors, the comp type is not supported.
"

It works in 64bit cpu because is testing other code:

{$ifdef CPUX86_64}
    AssertProp('ExtendedProp',TJSONFloat(5));
  {$else}
    AssertProp('ExtendedProp',4.56);
  {$endif}

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160719/1f238ac9/attachment.html>


More information about the fpc-devel mailing list