提交 f451275c authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

cosmetic: C++: add some brackets in if conditions

上级 e441bb28
...@@ -59,7 +59,9 @@ void DepLibSRTP::ClassInit() ...@@ -59,7 +59,9 @@ void DepLibSRTP::ClassInit()
const srtp_err_status_t err = srtp_init(); const srtp_err_status_t err = srtp_init();
if (DepLibSRTP::IsError(err)) if (DepLibSRTP::IsError(err))
{
MS_THROW_ERROR("srtp_init() failed: %s", DepLibSRTP::GetErrorString(err)); MS_THROW_ERROR("srtp_init() failed: %s", DepLibSRTP::GetErrorString(err));
}
} }
++globalInstances; ++globalInstances;
......
...@@ -27,7 +27,9 @@ inline static void onWalk(uv_handle_t* handle, void* /*arg*/) ...@@ -27,7 +27,9 @@ inline static void onWalk(uv_handle_t* handle, void* /*arg*/)
uv_has_ref(handle)); uv_has_ref(handle));
if (!uv_is_closing(handle)) if (!uv_is_closing(handle))
{
uv_close(handle, onCloseLoop); uv_close(handle, onCloseLoop);
}
} }
/* Static methods. */ /* Static methods. */
...@@ -41,7 +43,9 @@ void DepLibUV::ClassInit() ...@@ -41,7 +43,9 @@ void DepLibUV::ClassInit()
const int err = uv_loop_init(DepLibUV::loop); const int err = uv_loop_init(DepLibUV::loop);
if (err != 0) if (err != 0)
{
MS_ABORT("libuv loop initialization failed"); MS_ABORT("libuv loop initialization failed");
}
} }
void DepLibUV::ClassDestroy() void DepLibUV::ClassDestroy()
...@@ -63,13 +67,17 @@ void DepLibUV::ClassDestroy() ...@@ -63,13 +67,17 @@ void DepLibUV::ClassDestroy()
err = uv_loop_close(DepLibUV::loop); err = uv_loop_close(DepLibUV::loop);
if (err != UV_EBUSY) if (err != UV_EBUSY)
{
break; break;
}
uv_run(DepLibUV::loop, UV_RUN_NOWAIT); uv_run(DepLibUV::loop, UV_RUN_NOWAIT);
} }
if (err != 0) if (err != 0)
{
MS_ERROR_STD("failed to close libuv loop: %s", uv_err_name(err)); MS_ERROR_STD("failed to close libuv loop: %s", uv_err_name(err));
}
delete DepLibUV::loop; delete DepLibUV::loop;
} }
......
...@@ -127,7 +127,9 @@ uintptr_t DepUsrSCTP::GetNextSctpAssociationId() ...@@ -127,7 +127,9 @@ uintptr_t DepUsrSCTP::GetNextSctpAssociationId()
// NOTE: usrsctp_connect() fails with a value of 0. // NOTE: usrsctp_connect() fails with a value of 0.
if (DepUsrSCTP::nextSctpAssociationId == 0u) if (DepUsrSCTP::nextSctpAssociationId == 0u)
{
++DepUsrSCTP::nextSctpAssociationId; ++DepUsrSCTP::nextSctpAssociationId;
}
// In case we've wrapped around and need to find an empty spot from a removed // In case we've wrapped around and need to find an empty spot from a removed
// SctpAssociation. Assumes we'll never be full. // SctpAssociation. Assumes we'll never be full.
...@@ -137,7 +139,9 @@ uintptr_t DepUsrSCTP::GetNextSctpAssociationId() ...@@ -137,7 +139,9 @@ uintptr_t DepUsrSCTP::GetNextSctpAssociationId()
++DepUsrSCTP::nextSctpAssociationId; ++DepUsrSCTP::nextSctpAssociationId;
if (DepUsrSCTP::nextSctpAssociationId == 0u) if (DepUsrSCTP::nextSctpAssociationId == 0u)
{
++DepUsrSCTP::nextSctpAssociationId; ++DepUsrSCTP::nextSctpAssociationId;
}
} }
return DepUsrSCTP::nextSctpAssociationId++; return DepUsrSCTP::nextSctpAssociationId++;
...@@ -160,7 +164,9 @@ void DepUsrSCTP::RegisterSctpAssociation(RTC::SctpAssociation* sctpAssociation) ...@@ -160,7 +164,9 @@ void DepUsrSCTP::RegisterSctpAssociation(RTC::SctpAssociation* sctpAssociation)
DepUsrSCTP::mapIdSctpAssociation[sctpAssociation->id] = sctpAssociation; DepUsrSCTP::mapIdSctpAssociation[sctpAssociation->id] = sctpAssociation;
if (++DepUsrSCTP::numSctpAssociations == 1u) if (++DepUsrSCTP::numSctpAssociations == 1u)
{
DepUsrSCTP::checker->Start(); DepUsrSCTP::checker->Start();
}
} }
void DepUsrSCTP::DeregisterSctpAssociation(RTC::SctpAssociation* sctpAssociation) void DepUsrSCTP::DeregisterSctpAssociation(RTC::SctpAssociation* sctpAssociation)
...@@ -177,7 +183,9 @@ void DepUsrSCTP::DeregisterSctpAssociation(RTC::SctpAssociation* sctpAssociation ...@@ -177,7 +183,9 @@ void DepUsrSCTP::DeregisterSctpAssociation(RTC::SctpAssociation* sctpAssociation
MS_ASSERT(DepUsrSCTP::numSctpAssociations > 0u, "numSctpAssociations was not higher than 0"); MS_ASSERT(DepUsrSCTP::numSctpAssociations > 0u, "numSctpAssociations was not higher than 0");
if (--DepUsrSCTP::numSctpAssociations == 0u) if (--DepUsrSCTP::numSctpAssociations == 0u)
{
DepUsrSCTP::checker->Stop(); DepUsrSCTP::checker->Stop();
}
} }
RTC::SctpAssociation* DepUsrSCTP::RetrieveSctpAssociation(uintptr_t id) RTC::SctpAssociation* DepUsrSCTP::RetrieveSctpAssociation(uintptr_t id)
...@@ -189,7 +197,9 @@ RTC::SctpAssociation* DepUsrSCTP::RetrieveSctpAssociation(uintptr_t id) ...@@ -189,7 +197,9 @@ RTC::SctpAssociation* DepUsrSCTP::RetrieveSctpAssociation(uintptr_t id)
auto it = DepUsrSCTP::mapIdSctpAssociation.find(id); auto it = DepUsrSCTP::mapIdSctpAssociation.find(id);
if (it == DepUsrSCTP::mapIdSctpAssociation.end()) if (it == DepUsrSCTP::mapIdSctpAssociation.end())
{
return nullptr; return nullptr;
}
return it->second; return it->second;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论