[
https://issues.apache.org/jira/browse/THRIFT-2980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114512#comment-15114512
]
ASF GitHub Bot commented on THRIFT-2980:
----------------------------------------
GitHub user cjmay opened a pull request:
https://github.com/apache/thrift/pull/821
THRIFT-2980 Accept external buffer in thrift_memory_buffer constructor
Here's a pass at letting thrift_memory_buffer take its buffer as a
constructor argument:
Add buf (GByteArray pointer) and owner (gboolean) to constructor-only
properties. Create buf (object member) during construction if buf
(constructor-only property) is NULL, the default. Unref buf during finalize if
buf is non-NULL and owner is TRUE.
Also change semantics of buf_size slightly: default is now zero, max is
G_MAXUINT32, and zero is interpreted as no limit. (My thrift objects are often
very large; setting no limit as the default seems to simplify the usage in my
opinion, and I believe raising the maximum is harmless.)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cjmay/thrift THRIFT-2980
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/821.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #821
----
commit 939f66c638f68eb811bf22e4cb1a1a13fc2871cd
Author: Chandler May <[email protected]>
Date: 2016-01-24T03:27:27Z
THRIFT-2980 Accept external buffer in thrift_memory_buffer constructor
----
> ThriftMemoryBuffer doesn't have a constructor option to take an existing
> buffer
> -------------------------------------------------------------------------------
>
> Key: THRIFT-2980
> URL: https://issues.apache.org/jira/browse/THRIFT-2980
> Project: Thrift
> Issue Type: Improvement
> Components: C glib - Library
> Reporter: Eugene Tolmachev
>
> If I want to do a straight-up serialization/deserialization sans RPC I'd like
> to be able to read like this C# does:
> bq. Item Deserialize(byte[] bytes) { using (var trans = new
> TMemoryBuffer(bytes)) using (var proto = new TBinaryProtocol(trans)) return
> new Item().Do(item => item.Read(proto)); }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)