[gbinder] Added gbinder_remote_reply_copy_to_local(). JB#42956
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -50,6 +50,11 @@ gbinder_remote_reply_init_reader(
|
||||
GBinderRemoteReply* reply,
|
||||
GBinderReader* reader);
|
||||
|
||||
GBinderLocalReply*
|
||||
gbinder_remote_reply_copy_to_local(
|
||||
GBinderRemoteReply* reply) /* since 1.0.6 */
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/* Convenience function to decode replies with just one data item */
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
* Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
@@ -13,9 +13,9 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gbinder_local_reply_p.h"
|
||||
#include "gbinder_output_data.h"
|
||||
#include "gbinder_writer_p.h"
|
||||
#include "gbinder_buffer_p.h"
|
||||
#include "gbinder_log.h"
|
||||
|
||||
#include <gutil_intarray.h>
|
||||
@@ -92,6 +93,20 @@ gbinder_local_reply_new(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GBinderLocalReply*
|
||||
gbinder_local_reply_new_from_data(
|
||||
GBinderBuffer* buffer,
|
||||
void** objects)
|
||||
{
|
||||
const GBinderIo* io = gbinder_buffer_io(buffer);
|
||||
GBinderLocalReply* self = gbinder_local_reply_new(io);
|
||||
|
||||
if (self) {
|
||||
gbinder_writer_data_set_contents(&self->data, buffer, objects);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
gbinder_local_reply_free(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
* Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
@@ -13,9 +13,9 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -45,6 +45,11 @@ GBinderOutputData*
|
||||
gbinder_local_reply_data(
|
||||
GBinderLocalReply* reply);
|
||||
|
||||
GBinderLocalReply*
|
||||
gbinder_local_reply_new_from_data(
|
||||
GBinderBuffer* buffer,
|
||||
void** objects);
|
||||
|
||||
#endif /* GBINDER_LOCAL_REPLY_PRIVATE_H */
|
||||
|
||||
/*
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "gbinder_remote_reply_p.h"
|
||||
#include "gbinder_local_reply_p.h"
|
||||
#include "gbinder_reader_p.h"
|
||||
#include "gbinder_object_registry.h"
|
||||
#include "gbinder_buffer.h"
|
||||
@@ -117,6 +118,18 @@ gbinder_remote_reply_is_empty(
|
||||
return !self || !self->data.buffer || !self->data.buffer->size;
|
||||
}
|
||||
|
||||
GBinderLocalReply*
|
||||
gbinder_remote_reply_copy_to_local(
|
||||
GBinderRemoteReply* self)
|
||||
{
|
||||
if (G_LIKELY(self)) {
|
||||
GBinderReaderData* d = &self->data;
|
||||
|
||||
return gbinder_local_reply_new_from_data(d->buffer, d->objects);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user