CANParser::update_string :use const std::string& as paramater (#344)

This commit is contained in:
Dean Lee 2021-01-31 14:26:30 +08:00 committed by GitHub
parent 15a20d6aef
commit ec13e51c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ public:
const std::vector<SignalParseOptions> &sigoptions);
void UpdateCans(uint64_t sec, const capnp::List<cereal::CanData>::Reader& cans);
void UpdateValid(uint64_t sec);
void update_string(std::string data, bool sendcan);
void update_string(const std::string &data, bool sendcan);
std::vector<SignalValue> query_latest();
};

View File

@ -208,7 +208,7 @@ void CANParser::UpdateValid(uint64_t sec) {
}
}
void CANParser::update_string(std::string data, bool sendcan) {
void CANParser::update_string(const std::string &data, bool sendcan) {
// format for board, make copy due to alignment issues, will be freed on out of scope
auto amsg = kj::heapArray<capnp::word>((data.length() / sizeof(capnp::word)) + 1);
memcpy(amsg.begin(), data.data(), data.length());