From 9b53390c002321c1fe01b6eb98da987bf06e8666 Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Thu, 21 Aug 2014 15:24:57 +0300 Subject: [PATCH] Bug Fix : XWALK-1885 - use bool as guint8 sizeof gboolean and bool is different, this causes problems in case of using the library in cpp, so treating bool as single byte. Change-Id: Iafad60c41a8c826ddfa217b721f2a68ab858f5dd Signed-off-by: Amarnath Valluri --- INSTALL | 1 - lib/message-port.c | 18 +++++++++++------- lib/message-port.h | 2 +- tests/test-app.c | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/INSTALL b/INSTALL index a1e89e1..63bf076 100644 --- a/INSTALL +++ b/INSTALL @@ -367,4 +367,3 @@ operates. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff --git a/lib/message-port.c b/lib/message-port.c index e09e33b..16149bd 100644 --- a/lib/message-port.c +++ b/lib/message-port.c @@ -44,7 +44,7 @@ _messageport_register_port (const char *name, gboolean is_trusted, messageport_m } static messageport_error_e -_messageport_check_remote_port (const char *app_id, const char *port, gboolean is_trusted, gboolean *exists) +_messageport_check_remote_port (const char *app_id, const char *port, gboolean is_trusted, bool *exists) { messageport_error_e res; MsgPortManager *manager = msgport_factory_get_manager (); @@ -53,7 +53,7 @@ _messageport_check_remote_port (const char *app_id, const char *port, gboolean i res = msgport_manager_check_remote_service (manager, app_id, port, is_trusted, NULL); - if (exists) *exists = (res == MESSAGEPORT_ERROR_NONE); + if (exists) *exists = (bool)(res == MESSAGEPORT_ERROR_NONE); return res; } @@ -99,13 +99,13 @@ messageport_register_trusted_local_port (const char *local_port, messageport_mes } messageport_error_e -messageport_check_remote_port (const char *remote_app_id, const char *port_name, gboolean *exists) +messageport_check_remote_port (const char *remote_app_id, const char *port_name, bool *exists) { return _messageport_check_remote_port (remote_app_id, port_name, FALSE, exists); } messageport_error_e -messageport_check_trusted_remote_port (const char *remote_app_id, const char *port_name, gboolean *exists) +messageport_check_trusted_remote_port (const char *remote_app_id, const char *port_name, bool *exists) { return _messageport_check_remote_port (remote_app_id, port_name, TRUE, exists); } @@ -145,12 +145,16 @@ messageport_get_local_port_name(int id, char **name_out) } messageport_error_e -messageport_check_trusted_local_port (int id, gboolean *is_trusted_out) +messageport_check_trusted_local_port (int id, bool *is_trusted_out) { MsgPortManager *manager = msgport_factory_get_manager (); if (!manager) return MESSAGEPORT_ERROR_IO_ERROR; - return msgport_manager_get_service_is_trusted (manager, id, is_trusted_out); -} + gboolean is_trusted = FALSE; + messageport_error_e res = msgport_manager_get_service_is_trusted ( + manager, id, &is_trusted); + if (is_trusted_out) *is_trusted_out = (bool)is_trusted; + return res; +} diff --git a/lib/message-port.h b/lib/message-port.h index cf5591a..7b8cf0e 100644 --- a/lib/message-port.h +++ b/lib/message-port.h @@ -38,7 +38,7 @@ #include #ifndef __cplusplus -typedef gboolean bool; +typedef guint8 bool; #endif G_BEGIN_DECLS diff --git a/tests/test-app.c b/tests/test-app.c index c7a2bec..82658d4 100644 --- a/tests/test-app.c +++ b/tests/test-app.c @@ -99,7 +99,7 @@ void (_on_child_got_message)(int port_id, const char* remote_app_id, const char* void (_on_parent_got_message)(int port_id, const char* remote_app_id, const char* remote_port, gboolean trusted_message, bundle* data) { gchar *name = NULL; - gboolean found = FALSE; + bool found = FALSE; messageport_get_local_port_name (port_id, &name), g_debug ("PARENT: GOT MESSAGE at prot %s FROM :'%s' app - '%s' port", name, remote_app_id ? remote_app_id : "unknwon", remote_port ? remote_port : "unknwon"); @@ -176,7 +176,7 @@ static gboolean test_check_remote_port() { gchar remote_app_id[128]; - gboolean found = FALSE; + bool found = FALSE; messageport_error_e res; g_sprintf (remote_app_id, "%d", getppid()); -- 2.7.4