You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jeremy W. Sherman (JIRA)" <ji...@apache.org> on 2015/03/04 05:12:05 UTC

[jira] [Commented] (THRIFT-2987) TProtocol should return NSString directly rather than by reference to appease ARC

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

Jeremy W. Sherman commented on THRIFT-2987:
-------------------------------------------

The existing API appears to be due to mirroring the C++ API. That API returned the number of bytes written as a {{uint32_t}}.

The Obj-C API currently returns nothing, and the first by-ref object argument is the natural object to return from a read.

Switching the protocol to directly return the message/struct/field name both makes more sense in the Obj-C context and handily resolves the warning, at the cost of diverging slightly from the C++ implementation.

> TProtocol should return NSString directly rather than by reference to appease ARC
> ---------------------------------------------------------------------------------
>
>                 Key: THRIFT-2987
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2987
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Cocoa - Library
>            Reporter: Jeremy W. Sherman
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> As currently written, the compiler gripes like so:
> {code}
> thrift/lib/cocoa/src/protocol/TBinaryProtocol.m:161:55: warning: method parameter of type 'NSString *__autoreleasing *' with no explicit ownership [-Wexplicit-ownership-type]
> - (void) readMessageBeginReturningName: (NSString **) name
>                                                       ^
> {code}
> Annotating for ownership might make non-ARC builds unhappy, but since there is only one object being returned by reference, this and similar methods can just be changed to return the name directly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)