Page 1 of 1
How to read a signed integer from ByteArray
Posted: 30 May 2017, 07:52
by meodemsao
Hi all,
I have problem while reading a signed integer from server. In the SFS2X C++, the function "boost::shared_ptr <ByteArray> btrd->ReadInt" is always return a positive value.
Hope everyone to help for me to solve this problem
Thank in advanced!
Re: How to read a signed integer from ByteArray
Posted: 30 May 2017, 10:33
by Lapo
Hello,
I was able to reproduce the problem. There seem to be an issue with type conversion.
We're working on releasing a patch soon.
Stay tuned.
Re: How to read a signed integer from ByteArray
Posted: 30 May 2017, 12:01
by meodemsao
After some testcase, the function ReadInt only has problem with 64-bit arch. In the 32-bit arch, it's work well
Re: How to read a signed integer from ByteArray
Posted: 30 May 2017, 14:50
by Lapo
Yes, it's due to the variability of type sizes such as int / long int etc... which on 32bit platforms use 4 bytes and on 64bit systems use 8 bytes.
I'll report back when it's fixed.
Re: How to read a signed integer from ByteArray
Posted: 01 Jun 2017, 16:01
by Lapo
UPDATE:
we have fixed the problem and should be able to publish a new update on Monday (tomorrow is national holiday over here).
I will post the link here when it's online.
Cheers
Re: How to read a signed integer from ByteArray
Posted: 06 Jun 2017, 07:25
by Lapo
UPDATE 2:We have released an update of the API that fixes this issue:
http://smartfoxserver.com/download/sfs2x#p=clientThanks
Re: How to read a signed integer from ByteArray
Posted: 11 Jul 2017, 16:57
by meodemsao
Bravo
Thank in advanced