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

Code clean up based on cppcheck report.

上级 641c14f8
......@@ -44,7 +44,7 @@ namespace RTC
Protocol protocol;
uint16_t port;
CandidateType type;
TcpCandidateType tcpType;
TcpCandidateType tcpType = TcpCandidateType::PASSIVE;
};
}
......
......@@ -26,8 +26,8 @@ namespace RTC { namespace RTCP
virtual size_t GetSize() override;
private:
uint8_t *data;
size_t size;
uint8_t* data = nullptr;
size_t size = 0;
};
/* Inline instance methods. */
......
......@@ -58,7 +58,7 @@ namespace RTC { namespace RTCP
private:
Header* header = nullptr;
size_t length;
size_t length = 0;
};
// Rpsi packet declaration.
......
......@@ -88,7 +88,7 @@ namespace RTC { namespace RTCP
private:
// SSRC of packet sender.
uint32_t ssrc;
uint32_t ssrc = 0;
std::vector<ReceiverReport*> reports;
};
......
......@@ -17,12 +17,22 @@ if ! type "cppcheck-htmlreport" &> /dev/null; then
exit 1
fi
IGNORE_MACROS="-U SOCK_CLOEXEC -U SOCK_NONBLOCK"
CPPCHECKS="style,performance,portability,unusedFunction"
__IGNORE_MACROS="-U SOCK_CLOEXEC -U SOCK_NONBLOCK"
CPPCHECKS="warning,style,performance,portability,unusedFunction"
XML_FILE="/tmp/mediasoup-worker-cppcheck.xml"
REPORT_DIR="/tmp/mediasoup-worker-cppcheck-report"
cppcheck --std=c++11 --std=posix --enable=$CPPCHECKS -v -q --error-exitcode=1 -I include src --xml 2> $XML_FILE
echo ">>> [INFO] running cppcheck ..."
cppcheck --std=c++11 --enable=$CPPCHECKS -v --quiet --report-progress --inline-suppr --error-exitcode=13 -I include src --xml-version=2 2> $XML_FILE
# If exit code is 1 it means that some cppcheck option is wrong, so abort.
if [ $? -eq 1 ] ; then
echo ">>> [ERROR] cppcheck returned 1: wrong arguments" >&2
exit 1
fi
echo ">>> [INFO] running cppcheck-htmlreport ..."
cppcheck-htmlreport --title="mediasoup-worker" --file=$XML_FILE --report-dir=$REPORT_DIR --source-dir=. > /dev/null
echo ">>> [INFO] opening HTML report ..."
open $REPORT_DIR/index.html
......@@ -174,7 +174,7 @@ namespace RTC
// If bind() fails for more that MAX_BIND_ATTEMPTS then raise an error.
if (bind_attempt > MAX_BIND_ATTEMPTS)
MS_THROW_ERROR("uv_tcp_bind() fails more than %u times for IP '%s'", MAX_BIND_ATTEMPTS, listen_ip);
MS_THROW_ERROR("uv_tcp_bind() fails more than %" PRIu16 " times for IP '%s'", (uint16_t)MAX_BIND_ATTEMPTS, listen_ip);
// If we have tried all the ports in the range raise an error.
if (iterating_port == initial_port)
......
......@@ -173,7 +173,7 @@ namespace RTC
// If bind() fails for more that MAX_BIND_ATTEMPTS then raise an error.
if (bind_attempt > MAX_BIND_ATTEMPTS)
MS_THROW_ERROR("uv_udp_bind() fails more than %u times for IP '%s'", MAX_BIND_ATTEMPTS, listen_ip);
MS_THROW_ERROR("uv_udp_bind() fails more than %" PRIu16 " times for IP '%s'", (uint16_t)MAX_BIND_ATTEMPTS, listen_ip);
// If we have tried all the ports in the range raise an error.
if (iterating_port == initial_port)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论