get value by reference in ranged based loop (#624)

master
Dean Lee 2021-01-27 19:01:23 +08:00 committed by GitHub
parent e035fa1d09
commit f71fd7b91b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ DWORD PandaJ2534Device::kline_recv_thread() {
continue;
}
for (auto msg : msg_recv) {
for (auto &msg : msg_recv) {
for (auto& conn : this->connections) {
if (conn != nullptr && !conn->isProtoCan()) {
J2534Frame msg_out(conn->getProtocol(), msg);

View File

@ -323,7 +323,7 @@ bool Panda::can_send_many(const std::vector<PANDA_CAN_MSG>& can_msgs) {
std::vector<PANDA_CAN_MSG_INTERNAL> formatted_msgs;
formatted_msgs.reserve(can_msgs.size());
for (auto msg : can_msgs) {
for (auto &msg : can_msgs) {
if (msg.bus == PANDA_CAN_UNK) continue;
if (msg.len > 8) continue;
PANDA_CAN_MSG_INTERNAL tmpmsg = {};