Returns const pointer to UTF-16 string in binder's buffer. The
memory pointed to by this string gets automatically deallocated
by libgbinder when transaction completes.
Also added const to gbinder_reader_read_nullable_string16_utf16()
output argument. It may cause compilation warnings, but that makes
it obvious that caller doesn't deallocate the returned pointer, in
my opinion it's worth the trouble.
It allows to fetch a pointer to the hidl string contents (which must
be NULL terminated) without duplicating the string and allocating any
memory in the process.
Added gbinder_reader_skip_hidl_string() macro.
Reduced number of memory allocations performed by functions parsing
buffer objects. Many of them don't allocate any memory at all now.
gbinder_writer_append_fd() duplicates the descriptor and appends
the duplicate to the parcel. The caller may immediately close its
descriptor.
gbinder_reader_read_fd() fetches the descriptor from the parcel
without duplicating it. The descrriptor will be closed as soon as
the library has finished processing the request. Returns -1 on error.
gbinder_reader_read_dup_fd() fetches descriptor from the parcel
and dups it. The caller is responsible for closing the returned
descriptor. Returns -1 on failure.
This function allows to read UTF-16 strings from Java parcel as UTF-16,
without any conversion.
As a side effect, it also allows parsing strings containing embedded
NULL characters.
Even though it's just a straight memcpy at the moment.
Also, constified GBinderReader pointer where appropriate.
This allows passing const GBinderReader pointer as a parameter and
a) allow the callee to parse the payload and b) make sure that the
caller's reader doesn't get damaged (well, or at least warn the callee
that it's doing the wrong thing).
As well as two macros for reading arrays:
gbinder_reader_read_hidl_type_vec() - vec<type>
gbinder_reader_read_hidl_byte_vec() - vec<uint8_t>
These convenient for pulling structures and arrays from hwbinder
requests and responses.
Note that data are not being copied, all these macros return pointers
to the memory buffer passed to us by the kernel. Such pointers remain
valid as long the associated remote request/response is alive.
This provides a generic way to read any array of any primitive
types or structures. Note that it doesn't copy the data and
directly returns the pointer provided by the kernel.