From fa0374517fd30043f9c2bb1021a96f45ee7f6dc8 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 16 May 2018 15:11:17 +0200 Subject: [PATCH] fix(core): add some casts on bool_t to bool (for windows warnings) --- coreapi/chat.c | 2 +- coreapi/linphonecore.c | 14 +++++++------- coreapi/vtables.c | 2 +- src/sal/sal.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 13c8da0f2..df42841ee 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -69,7 +69,7 @@ const bctbx_list_t *linphone_core_get_chat_rooms (LinphoneCore *lc) { static LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(core)->getOrCreateBasicChatRoom( *L_GET_CPP_PTR_FROM_C_OBJECT(addr), - linphone_core_realtime_text_enabled(core) + !!linphone_core_realtime_text_enabled(core) )); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 96c2bbb31..cc3931c7b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1888,7 +1888,7 @@ void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers } void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) { - lc->sal->enableDnsSrv(enable); + lc->sal->enableDnsSrv(!!enable); if (linphone_core_ready(lc)) lp_config_set_int(lc->config, "net", "dns_srv_enabled", enable ? 1 : 0); } @@ -1898,7 +1898,7 @@ bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) { } void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable) { - lc->sal->enableDnsSearch(enable); + lc->sal->enableDnsSearch(!!enable); if (linphone_core_ready(lc)) lp_config_set_int(lc->config, "net", "dns_search_enabled", enable ? 1 : 0); } @@ -3261,7 +3261,7 @@ void linphone_core_iterate(LinphoneCore *lc){ uint64_t curtime_ms = ms_get_cur_time_ms(); /*monotonic time*/ time_t current_real_time = ms_time(NULL); int64_t diff_time; - bool_t one_second_elapsed=FALSE; + bool one_second_elapsed = false; if (lc->network_reachable_to_be_notified) { lc->network_reachable_to_be_notified=FALSE; @@ -3274,7 +3274,7 @@ void linphone_core_iterate(LinphoneCore *lc){ lc->prevtime_ms = curtime_ms; } if ((diff_time=(int64_t)(curtime_ms-lc->prevtime_ms)) >= 1000){ - one_second_elapsed=TRUE; + one_second_elapsed = true; if (diff_time>3000){ /*since monotonic time doesn't increment while machine is sleeping, we don't want to catchup too much*/ lc->prevtime_ms = curtime_ms; @@ -4352,7 +4352,7 @@ const char *linphone_core_get_root_ca(LinphoneCore *lc){ } void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno){ - lc->sal->verifyServerCertificates(yesno); + lc->sal->verifyServerCertificates(!!yesno); if (lc->http_crypto_config){ belle_tls_crypto_config_set_verify_exceptions(lc->http_crypto_config, yesno ? 0 : BELLE_TLS_VERIFY_ANY_REASON); } @@ -4360,7 +4360,7 @@ void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno){ } void linphone_core_verify_server_cn(LinphoneCore *lc, bool_t yesno){ - lc->sal->verifyServerCn(yesno); + lc->sal->verifyServerCn(!!yesno); if (lc->http_crypto_config){ belle_tls_crypto_config_set_verify_exceptions(lc->http_crypto_config, yesno ? 0 : BELLE_TLS_VERIFY_CN_MISMATCH); } @@ -6365,7 +6365,7 @@ const char *linphone_error_to_string(LinphoneReason err){ void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) { if (enable > 0) { - lc->sal->useTcpTlsKeepAlive(lc->sip_conf.tcp_tls_keepalive); + lc->sal->useTcpTlsKeepAlive(!!lc->sip_conf.tcp_tls_keepalive); lc->sal->setKeepAlivePeriod(lc->sip_conf.keepalive_period); } else { lc->sal->setKeepAlivePeriod(0); diff --git a/coreapi/vtables.c b/coreapi/vtables.c index a789f72f3..1f227bd2c 100644 --- a/coreapi/vtables.c +++ b/coreapi/vtables.c @@ -244,7 +244,7 @@ void linphone_core_notify_configuring_status(LinphoneCore *lc, LinphoneConfiguri } void linphone_core_notify_network_reachable(LinphoneCore *lc, bool_t reachable) { - L_GET_PRIVATE_FROM_C_OBJECT(lc)->notifyNetworkReachable(!!lc->sip_network_reachable, lc->media_network_reachable); + L_GET_PRIVATE_FROM_C_OBJECT(lc)->notifyNetworkReachable(!!lc->sip_network_reachable, !!lc->media_network_reachable); NOTIFY_IF_EXIST(network_reachable, lc,reachable); cleanup_dead_vtable_refs(lc); } diff --git a/src/sal/sal.h b/src/sal/sal.h index 368d40fa2..082929f1b 100644 --- a/src/sal/sal.h +++ b/src/sal/sal.h @@ -235,10 +235,10 @@ public: void setDnsServers (const bctbx_list_t *servers); void enableDnsSearch (bool value) { belle_sip_stack_enable_dns_search(mStack, (unsigned char)value); } - bool dnsSearchEnabled () const { return belle_sip_stack_dns_search_enabled(mStack); } + bool dnsSearchEnabled () const { return !!belle_sip_stack_dns_search_enabled(mStack); } void enableDnsSrv (bool value) { belle_sip_stack_enable_dns_srv(mStack, (unsigned char)value); } - bool dnsSrvEnabled () const { return belle_sip_stack_dns_srv_enabled(mStack); } + bool dnsSrvEnabled () const { return !!belle_sip_stack_dns_srv_enabled(mStack); } void setDnsUserHostsFile (const std::string &value); const std::string &getDnsUserHostsFile () const;