Skip to content

Commit 6ec2a43

Browse files
Additional clang-tidy fixes, 0 warning threshold
1 parent 8c62f8d commit 6ec2a43

5 files changed

Lines changed: 11 additions & 14 deletions

File tree

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Checks: >
88
-bugprone-easily-swappable-parameters,
99
-modernize-use-trailing-return-type,
1010
-modernize-avoid-c-arrays,
11+
-modernize-use-auto,
1112
-modernize-use-nodiscard,
1213
-performance-enum-size,
1314
-readability-braces-around-statements,

.github/workflows/builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ jobs:
669669
- name: Check warning thresholds
670670
env:
671671
TIDY_FINDINGS: ${{ steps.linter.outputs.clang-tidy-checks-failed }}
672-
MAX_TIDY_FINDINGS: '396'
672+
MAX_TIDY_FINDINGS: '0'
673673
run: |
674674
echo "clang-tidy findings: ${TIDY_FINDINGS}"
675675
if [ "${TIDY_FINDINGS}" -gt "${MAX_TIDY_FINDINGS}" ]; then

src/audio_frame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ AudioFrame::fromOwnedInfo(const proto::OwnedAudioFrameBuffer &owned) {
6868
const std::size_t count = static_cast<std::size_t>(num_channels) *
6969
static_cast<std::size_t>(samples_per_channel);
7070

71-
const auto *ptr =
71+
const std::int16_t *ptr =
7272
reinterpret_cast<const std::int16_t *>(info.data_ptr()); // NOLINT(performance-no-int-to-ptr)
7373

7474
if (ptr == nullptr && count > 0) {

src/room_proto_converter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ DataPacketKind toDataPacketKind(proto::DataPacketKind in) {
5757
case proto::KIND_LOSSY:
5858
return DataPacketKind::Lossy;
5959
case proto::KIND_RELIABLE:
60-
return DataPacketKind::Reliable;
6160
default:
6261
return DataPacketKind::Reliable;
6362
}
@@ -74,7 +73,7 @@ UserPacketData fromProto(const proto::UserPacket &in) {
7473
UserPacketData out;
7574
// TODO, double check following code is safe
7675
const auto &buf = in.data().data();
77-
auto ptr = reinterpret_cast<const std::uint8_t *>(buf.data_ptr());
76+
auto ptr = reinterpret_cast<const std::uint8_t *>(buf.data_ptr()); // NOLINT(performance-no-int-to-ptr)
7877
auto len = static_cast<std::size_t>(buf.data_len());
7978
out.data.assign(ptr, ptr + len);
8079
if (in.has_topic()) {
@@ -386,7 +385,7 @@ UserDataPacketEvent userDataPacketFromProto(const proto::DataPacketReceived &in,
386385
const auto &owned = in.user().data();
387386
const auto &info = owned.data();
388387
if (info.data_ptr() != 0 && info.data_len() > 0) {
389-
auto ptr = reinterpret_cast<const std::uint8_t *>(info.data_ptr());
388+
auto ptr = reinterpret_cast<const std::uint8_t *>(info.data_ptr()); // NOLINT(performance-no-int-to-ptr)
390389
auto len = static_cast<std::size_t>(info.data_len());
391390
ev.data.assign(ptr, ptr + len);
392391
} else {

src/video_frame.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ std::size_t computeBufferSize(int width, int height, VideoBufferType type) {
4646
return w * h * 4;
4747

4848
case VideoBufferType::RGB24:
49-
// 3 bytes per pixel
50-
return w * h * 3;
51-
5249
case VideoBufferType::I444:
53-
// Y, U, V all full resolution
50+
// 3 bytes per pixel (RGB24: packed; I444: Y+U+V all full resolution)
5451
return w * h * 3;
5552

5653
case VideoBufferType::I420:
@@ -295,7 +292,7 @@ VideoFrame::VideoFrame(int width, int height, VideoBufferType type,
295292
VideoFrame VideoFrame::create(int width, int height, VideoBufferType type) {
296293
const std::size_t size = computeBufferSize(width, height, type);
297294
std::vector<std::uint8_t> buffer(size, 0);
298-
return VideoFrame(width, height, type, std::move(buffer));
295+
return {width, height, type, std::move(buffer)};
299296
}
300297

301298
std::vector<VideoPlaneInfo> VideoFrame::planeInfos() const {
@@ -315,7 +312,7 @@ VideoFrame VideoFrame::convert(VideoBufferType dst, bool flip_y) const {
315312
LK_LOG_WARN("VideoFrame::convert: converting to the same format");
316313
// copy pixel data
317314
std::vector<std::uint8_t> buf = data_;
318-
return VideoFrame(width_, height_, type_, std::move(buf));
315+
return {width_, height_, type_, std::move(buf)};
319316
}
320317

321318
// General path: delegate to the FFI-based conversion helper.
@@ -342,15 +339,15 @@ VideoFrame VideoFrame::fromOwnedInfo(const proto::OwnedVideoBuffer &owned) {
342339
std::size_t offset = 0;
343340
for (const auto &comp : info.components()) {
344341
const auto sz = static_cast<std::size_t>(comp.size());
345-
const auto src_ptr = reinterpret_cast<const std::uint8_t *>(
342+
const auto src_ptr = reinterpret_cast<const std::uint8_t *>( // NOLINT(performance-no-int-to-ptr)
346343
static_cast<std::uintptr_t>(comp.data_ptr()));
347344

348345
std::memcpy(buffer.data() + offset, src_ptr, sz);
349346
offset += sz;
350347
}
351348
} else {
352349
// Packed format: treat top-level data_ptr as a single contiguous buffer.
353-
const auto src_ptr = reinterpret_cast<const std::uint8_t *>(
350+
const auto src_ptr = reinterpret_cast<const std::uint8_t *>( // NOLINT(performance-no-int-to-ptr)
354351
static_cast<std::uintptr_t>(info.data_ptr()));
355352

356353
std::size_t total_size = 0;
@@ -373,7 +370,7 @@ VideoFrame VideoFrame::fromOwnedInfo(const proto::OwnedVideoBuffer &owned) {
373370
// owned_handle destroyed at end of scope → native buffer disposed.
374371
}
375372

376-
return VideoFrame(width, height, type, std::move(buffer));
373+
return {width, height, type, std::move(buffer)};
377374
}
378375

379376
} // namespace livekit

0 commit comments

Comments
 (0)