Skip to content

Commit ccc021f

Browse files
Additional clang-tidy checks
1 parent 4edfe8e commit ccc021f

9 files changed

Lines changed: 12 additions & 13 deletions

File tree

.github/workflows/builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ jobs:
657657
files-changed-only: false
658658
lines-changed-only: false
659659
extensions: 'c,cpp,cc,cxx'
660-
ignore: 'build-*|cpp-example-collection|client-sdk-rust|vcpkg_installed|src/tests|bridge/tests'
660+
ignore: 'build-*|cpp-example-collection|client-sdk-rust|vcpkg_installed|src/tests|bridge/tests|src/room_event_converter.cpp'
661661
file-annotations: true
662662
thread-comments: update
663663
step-summary: true

src/audio_stream.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ void AudioStream::onFfiEvent(const FfiEvent &event) {
212212
}
213213
if (ase.has_frame_received()) {
214214
const auto &fr = ase.frame_received();
215-
AudioFrame frame = AudioFrame::fromOwnedInfo(fr.frame());
216-
AudioFrameEvent ev{std::move(frame)};
215+
AudioFrameEvent ev{AudioFrame::fromOwnedInfo(fr.frame())};
217216
pushFrame(std::move(ev));
218217
} else if (ase.has_eos()) {
219218
pushEos();

src/data_track_stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ bool DataTrackStream::read(DataTrackFrame &out) {
5858
std::unique_lock<std::mutex> lock(mutex_);
5959
cv_.wait(lock, [this] { return frame_.has_value() || eof_ || closed_; });
6060

61-
if (closed_ || (!frame_.has_value() && eof_)) {
61+
if (closed_ || !frame_.has_value()) {
6262
return false;
6363
}
6464

src/e2ee.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ namespace livekit {
2929
namespace {
3030

3131
std::string bytesToString(const std::vector<std::uint8_t> &v) {
32-
return std::string(reinterpret_cast<const char *>(v.data()), v.size());
32+
return {reinterpret_cast<const char *>(v.data()), v.size()};
3333
}
3434

3535
std::vector<std::uint8_t> stringToBytes(const std::string &s) {
36-
return std::vector<std::uint8_t>(s.begin(), s.end());
36+
return {s.begin(), s.end()};
3737
}
3838

3939
} // namespace

src/ffi_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace livekit {
3737
namespace {
3838

3939
std::string bytesToString(const std::vector<std::uint8_t> &b) {
40-
return std::string(reinterpret_cast<const char *>(b.data()), b.size());
40+
return {reinterpret_cast<const char *>(b.data()), b.size()};
4141
}
4242

4343
inline void logAndThrow(const std::string &error_msg) {

src/room.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
297297
VideoStream::Options opts) {
298298
if (subscription_thread_dispatcher_) {
299299
subscription_thread_dispatcher_->setOnVideoFrameCallback(
300-
participant_identity, source, std::move(callback), std::move(opts));
300+
participant_identity, source, std::move(callback), opts);
301301
}
302302
}
303303

@@ -307,7 +307,7 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
307307
VideoStream::Options opts) {
308308
if (subscription_thread_dispatcher_) {
309309
subscription_thread_dispatcher_->setOnVideoFrameCallback(
310-
participant_identity, track_name, std::move(callback), std::move(opts));
310+
participant_identity, track_name, std::move(callback), opts);
311311
}
312312
}
313313

src/room_proto_converter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ SipDtmfReceivedEvent sipDtmfFromProto(const proto::DataPacketReceived &in,
400400
RemoteParticipant *participant) {
401401
SipDtmfReceivedEvent ev;
402402
ev.participant = participant;
403-
ev.code = in.sip_dtmf().code();
403+
ev.code = static_cast<int>(in.sip_dtmf().code());
404404
ev.digit = in.sip_dtmf().digit();
405405
return ev;
406406
}

src/rpc_error.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ proto::RpcError RpcError::toProto() const {
4949

5050
RpcError RpcError::fromProto(const proto::RpcError &err) {
5151
// proto::RpcError.data() will return empty string if unset, which is fine.
52-
return RpcError(err.code(), err.message(), err.data());
52+
return {err.code(), err.message(), err.data()};
5353
}
5454

5555
RpcError RpcError::builtIn(ErrorCode code, const std::string &data) {
5656
const char *msg = defaultMessageFor(code);
57-
return RpcError(code, msg ? std::string(msg) : std::string{}, data);
57+
return {code, msg ? std::string(msg) : std::string{}, data};
5858
}
5959

6060
const char *RpcError::defaultMessageFor(ErrorCode code) {

src/video_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ VideoFrame fromOwnedProto(const proto::OwnedVideoBuffer &owned) {
146146
if (src_ptr == 0) {
147147
throw std::runtime_error("fromOwnedProto: info.data_ptr is null");
148148
}
149-
const auto *src = reinterpret_cast<const std::uint8_t *>(src_ptr);
149+
const auto *src = reinterpret_cast<const std::uint8_t *>(src_ptr); // NOLINT(performance-no-int-to-ptr)
150150

151151
std::memcpy(dst, src, dst_size);
152152

0 commit comments

Comments
 (0)