You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2013/05/21 02:11:17 UTC

[jira] [Comment Edited] (THRIFT-1973) TCompactProtocol in C# lib does not serialize and deserialize negative int32 and int64 number correctly

    [ https://issues.apache.org/jira/browse/THRIFT-1973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13662489#comment-13662489 ] 

Jens Geyer edited comment on THRIFT-1973 at 5/21/13 12:09 AM:
--------------------------------------------------------------

{quote}
And the test cases already in the test project failed for negative numbers on server vs what was sent from the client. 
{quote}

Just curious (and without having tried myself): What type are these negative numbers of? Maybe i64 and/or byte? Or same as above, or any (integer) type?
                
      was (Author: jensg):
    {quote}
And the test cases already in the test project failed for negative numbers on server vs what was sent from the client. 
{quote}

Just curious (and without having tried myself): What type are these negative numbers of? Maybe i64 and/or byte?
                  
> TCompactProtocol in C# lib does not serialize and deserialize negative int32 and int64 number correctly
> -------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1973
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1973
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Library
>    Affects Versions: 0.9, 1.0
>         Environment: Windows
>            Reporter: Eric Ding
>              Labels: PatchAvailable
>             Fix For: 1.0
>
>         Attachments: thrift-1973-TCompactProtocol-Fix.patch
>
>
> longToZigzag and ZigzagToLong in TCompactProtocol does not perform corresponding operations to serialize and deserialize negative int32 and int64 number correctly.  Purpose to change longToZigzag from (ulong)(((ulong)n << 1) ^ ((ulong)n >> 63)) to (ulong)(n << 1) ^ (ulong)(n >> 63).
> Will need to do same for intToZigZag.  The reason is that we want arithmetic shift not logic shift.  
> The test case in the project shows this, the output on server and client are different even though client received the same number back.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira