Compare commits
	
		
			6 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a292ee46b8 | ||
| 
						 | 
					4624e8064f | ||
| 
						 | 
					e468b27e69 | ||
| 
						 | 
					a5c0bd0c62 | ||
| 
						 | 
					ad7701b5a9 | ||
| 
						 | 
					0a69f00787 | 
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -24,7 +24,7 @@ all: debug release pkgconfig
 | 
			
		||||
 | 
			
		||||
VERSION_MAJOR = 1
 | 
			
		||||
VERSION_MINOR = 0
 | 
			
		||||
VERSION_RELEASE = 2
 | 
			
		||||
VERSION_RELEASE = 3
 | 
			
		||||
 | 
			
		||||
# Version for pkg-config
 | 
			
		||||
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,10 @@
 | 
			
		||||
libgbinder (1.0.3) unstable; urgency=low
 | 
			
		||||
 | 
			
		||||
  * Added gbinder_local_request_append_bool()
 | 
			
		||||
  * Added gbinder_local_reply_append_bool()
 | 
			
		||||
 | 
			
		||||
 -- Slava Monich <slava.monich@jolla.com>  Mon, 06 Aug 2018 19:15:29 +0300
 | 
			
		||||
 | 
			
		||||
libgbinder (1.0.2) unstable; urgency=low
 | 
			
		||||
 | 
			
		||||
  * Added gbinder_remote_request_sender_pid()
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,11 @@ gbinder_local_reply_cleanup(
 | 
			
		||||
    GDestroyNotify destroy,
 | 
			
		||||
    gpointer pointer);
 | 
			
		||||
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
gbinder_local_reply_append_bool(
 | 
			
		||||
    GBinderLocalReply* reply,
 | 
			
		||||
    gboolean value); /* since 1.0.3 */
 | 
			
		||||
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
gbinder_local_reply_append_int32(
 | 
			
		||||
    GBinderLocalReply* reply,
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,11 @@ gbinder_local_request_cleanup(
 | 
			
		||||
    GDestroyNotify destroy,
 | 
			
		||||
    gpointer pointer);
 | 
			
		||||
 | 
			
		||||
GBinderLocalRequest*
 | 
			
		||||
gbinder_local_request_append_bool(
 | 
			
		||||
    GBinderLocalRequest* request,
 | 
			
		||||
    gboolean value); /* since 1.0.3 */
 | 
			
		||||
 | 
			
		||||
GBinderLocalRequest*
 | 
			
		||||
gbinder_local_request_append_int32(
 | 
			
		||||
    GBinderLocalRequest* request,
 | 
			
		||||
 
 | 
			
		||||
@@ -56,11 +56,11 @@ gbinder_remote_request_init_reader(
 | 
			
		||||
 | 
			
		||||
pid_t
 | 
			
		||||
gbinder_remote_request_sender_pid(
 | 
			
		||||
    GBinderRemoteRequest* req);
 | 
			
		||||
    GBinderRemoteRequest* req); /* since 1.0.2 */
 | 
			
		||||
 | 
			
		||||
uid_t
 | 
			
		||||
gbinder_remote_request_sender_euid(
 | 
			
		||||
    GBinderRemoteRequest* req);
 | 
			
		||||
    GBinderRemoteRequest* req); /* since 1.0.2 */
 | 
			
		||||
 | 
			
		||||
/* Convenience function to decode requests with just one data item */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
Name: libgbinder
 | 
			
		||||
Version: 1.0.2
 | 
			
		||||
Version: 1.0.3
 | 
			
		||||
Release: 0
 | 
			
		||||
Summary: Binder client library
 | 
			
		||||
Group: Development/Libraries
 | 
			
		||||
 
 | 
			
		||||
@@ -160,6 +160,17 @@ gbinder_local_reply_init_writer(
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
gbinder_local_reply_append_bool(
 | 
			
		||||
    GBinderLocalReply* self,
 | 
			
		||||
    gboolean value)
 | 
			
		||||
{
 | 
			
		||||
    if (G_LIKELY(self)) {
 | 
			
		||||
        gbinder_writer_data_append_bool(&self->data, value);
 | 
			
		||||
    }
 | 
			
		||||
    return self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GBinderLocalReply*
 | 
			
		||||
gbinder_local_reply_append_int32(
 | 
			
		||||
    GBinderLocalReply* self,
 | 
			
		||||
 
 | 
			
		||||
@@ -169,6 +169,17 @@ gbinder_local_request_init_writer(
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GBinderLocalRequest*
 | 
			
		||||
gbinder_local_request_append_bool(
 | 
			
		||||
    GBinderLocalRequest* self,
 | 
			
		||||
    gboolean value)
 | 
			
		||||
{
 | 
			
		||||
    if (G_LIKELY(self)) {
 | 
			
		||||
        gbinder_writer_data_append_bool(&self->data, value);
 | 
			
		||||
    }
 | 
			
		||||
    return self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GBinderLocalRequest*
 | 
			
		||||
gbinder_local_request_append_int32(
 | 
			
		||||
    GBinderLocalRequest* self,
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,31 @@ gbinder_writer_init(
 | 
			
		||||
    gbinder_writer_cast(self)->data = data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_append_bool(
 | 
			
		||||
    GBinderWriter* self,
 | 
			
		||||
    gboolean value)
 | 
			
		||||
{
 | 
			
		||||
    GBinderWriterData* data = gbinder_writer_data(self);
 | 
			
		||||
 | 
			
		||||
    if (G_LIKELY(data)) {
 | 
			
		||||
        gbinder_writer_data_append_bool(data, value);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_data_append_bool(
 | 
			
		||||
    GBinderWriterData* data,
 | 
			
		||||
    gboolean value)
 | 
			
		||||
{
 | 
			
		||||
    guint8 padded[4];
 | 
			
		||||
 | 
			
		||||
    /* Boolean values are padded to 4-byte boundary */
 | 
			
		||||
    padded[0] = (value != FALSE);
 | 
			
		||||
    padded[1] = padded[2] = padded[3] = 0xff;
 | 
			
		||||
    g_byte_array_append(data->bytes, padded, sizeof(padded));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_append_int32(
 | 
			
		||||
    GBinderWriter* self,
 | 
			
		||||
@@ -291,19 +316,6 @@ gbinder_writer_data_append_string16_len(
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_append_bool(
 | 
			
		||||
    GBinderWriter* self,
 | 
			
		||||
    gboolean value)
 | 
			
		||||
{
 | 
			
		||||
    guint8 padded[4];
 | 
			
		||||
 | 
			
		||||
    /* Boolean values are padded to 4-byte boundary */
 | 
			
		||||
    padded[0] = (value != FALSE);
 | 
			
		||||
    padded[1] = padded[2] = padded[3] = 0xff;
 | 
			
		||||
    gbinder_writer_append_bytes(self, padded, sizeof(padded));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_append_bytes(
 | 
			
		||||
    GBinderWriter* self,
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,11 @@ gbinder_writer_init(
 | 
			
		||||
    GBinderWriter* writer,
 | 
			
		||||
    GBinderWriterData* data);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_data_append_bool(
 | 
			
		||||
    GBinderWriterData* data,
 | 
			
		||||
    gboolean value);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
gbinder_writer_data_append_int32(
 | 
			
		||||
    GBinderWriterData* data,
 | 
			
		||||
 
 | 
			
		||||
@@ -110,6 +110,47 @@ test_cleanup(
 | 
			
		||||
    g_assert(count == 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * bool
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
test_bool(
 | 
			
		||||
    void)
 | 
			
		||||
{
 | 
			
		||||
    static const guint8 output_true[] = { 0x01, 0xff, 0xff, 0xff };
 | 
			
		||||
    static const guint8 output_false[] = { 0x00, 0xff, 0xff, 0xff };
 | 
			
		||||
    GBinderLocalReply* reply = gbinder_local_reply_new(&gbinder_io_32);
 | 
			
		||||
    GBinderOutputData* data;
 | 
			
		||||
 | 
			
		||||
    gbinder_local_reply_append_bool(reply, FALSE);
 | 
			
		||||
    data = gbinder_local_reply_data(reply);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_false));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_false, data->bytes->len));
 | 
			
		||||
    gbinder_local_reply_unref(reply);
 | 
			
		||||
 | 
			
		||||
    reply = gbinder_local_reply_new(&gbinder_io_32);
 | 
			
		||||
    gbinder_local_reply_append_bool(reply, TRUE);
 | 
			
		||||
    data = gbinder_local_reply_data(reply);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_true));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_true, data->bytes->len));
 | 
			
		||||
    gbinder_local_reply_unref(reply);
 | 
			
		||||
 | 
			
		||||
    reply = gbinder_local_reply_new(&gbinder_io_32);
 | 
			
		||||
    gbinder_local_reply_append_bool(reply, 42);
 | 
			
		||||
    data = gbinder_local_reply_data(reply);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_true));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_true, data->bytes->len));
 | 
			
		||||
    gbinder_local_reply_unref(reply);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * int32
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
@@ -361,6 +402,7 @@ int main(int argc, char* argv[])
 | 
			
		||||
    g_test_init(&argc, &argv, NULL);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "null", test_null);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "cleanup", test_cleanup);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "bool", test_bool);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "int32", test_int32);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "int64", test_int64);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "string8", test_string8);
 | 
			
		||||
 
 | 
			
		||||
@@ -76,6 +76,7 @@ test_null(
 | 
			
		||||
    g_assert(count == 1);
 | 
			
		||||
 | 
			
		||||
    g_assert(!gbinder_local_request_data(NULL));
 | 
			
		||||
    g_assert(!gbinder_local_request_append_bool(NULL, FALSE));
 | 
			
		||||
    g_assert(!gbinder_local_request_append_int32(NULL, 0));
 | 
			
		||||
    g_assert(!gbinder_local_request_append_int64(NULL, 0));
 | 
			
		||||
    g_assert(!gbinder_local_request_append_string8(NULL, NULL));
 | 
			
		||||
@@ -140,6 +141,47 @@ test_init_data(
 | 
			
		||||
    g_bytes_unref(init_bytes);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * bool
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
 | 
			
		||||
static
 | 
			
		||||
void
 | 
			
		||||
test_bool(
 | 
			
		||||
    void)
 | 
			
		||||
{
 | 
			
		||||
    static const guint8 output_true[] = { 0x01, 0xff, 0xff, 0xff };
 | 
			
		||||
    static const guint8 output_false[] = { 0x00, 0xff, 0xff, 0xff };
 | 
			
		||||
    GBinderLocalRequest* req = gbinder_local_request_new(&gbinder_io_32, NULL);
 | 
			
		||||
    GBinderOutputData* data;
 | 
			
		||||
 | 
			
		||||
    gbinder_local_request_append_bool(req, FALSE);
 | 
			
		||||
    data = gbinder_local_request_data(req);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_false));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_false, data->bytes->len));
 | 
			
		||||
    gbinder_local_request_unref(req);
 | 
			
		||||
 | 
			
		||||
    req = gbinder_local_request_new(&gbinder_io_32, NULL);
 | 
			
		||||
    gbinder_local_request_append_bool(req, TRUE);
 | 
			
		||||
    data = gbinder_local_request_data(req);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_true));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_true, data->bytes->len));
 | 
			
		||||
    gbinder_local_request_unref(req);
 | 
			
		||||
 | 
			
		||||
    req = gbinder_local_request_new(&gbinder_io_32, NULL);
 | 
			
		||||
    gbinder_local_request_append_bool(req, 42);
 | 
			
		||||
    data = gbinder_local_request_data(req);
 | 
			
		||||
    g_assert(!gbinder_output_data_offsets(data));
 | 
			
		||||
    g_assert(!gbinder_output_data_buffers_size(data));
 | 
			
		||||
    g_assert(data->bytes->len == sizeof(output_true));
 | 
			
		||||
    g_assert(!memcmp(data->bytes->data, output_true, data->bytes->len));
 | 
			
		||||
    gbinder_local_request_unref(req);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*==========================================================================*
 | 
			
		||||
 * int32
 | 
			
		||||
 *==========================================================================*/
 | 
			
		||||
@@ -360,6 +402,7 @@ int main(int argc, char* argv[])
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "null", test_null);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "cleanup", test_cleanup);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "init_data", test_init_data);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "bool", test_bool);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "int32", test_int32);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "int64", test_int64);
 | 
			
		||||
    g_test_add_func(TEST_PREFIX "string8", test_string8);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user