closeSession: actually remove elements from sessions_
std::remove_if consolidates the non-removed elements at the start of the vector, but it doesn't change the vector's size. After upgrading libc++, std::remove_if is [[nodiscard]], so this bug causes a compiler error. Bug: 175635923 Test: m android.hardware.drm-service.castkey Change-Id: Ie9734e616f0f93e290cd61f929af04598f236ee7
This commit is contained in:
parent
d2d72deda9
commit
0d97a2bd57
1 changed files with 5 additions and 4 deletions
|
@ -29,10 +29,11 @@ std::vector<uint8_t> SessionLibrary::createSession() {
|
||||||
|
|
||||||
void SessionLibrary::closeSession(const std::vector<uint8_t>& session) {
|
void SessionLibrary::closeSession(const std::vector<uint8_t>& session) {
|
||||||
std::lock_guard<std::mutex> guard(session_lock_);
|
std::lock_guard<std::mutex> guard(session_lock_);
|
||||||
std::remove_if(sessions_.begin(), sessions_.end(),
|
sessions_.erase(std::remove_if(sessions_.begin(), sessions_.end(),
|
||||||
[&session](const std::vector<uint8_t>& e) {
|
[&session](const std::vector<uint8_t>& e) {
|
||||||
return std::equal(e.begin(), e.end(), session.begin());
|
return std::equal(e.begin(), e.end(), session.begin());
|
||||||
});
|
}),
|
||||||
|
sessions_.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace castkeydrm
|
} // namespace castkeydrm
|
Loading…
Add table
Add a link
Reference in a new issue