DeviceLister refactoring for new API
3 unresolved threads
3 unresolved threads
Merge request reports
Activity
Filter activity
changed milestone to %3.3
added Media Indexing & Backend Medialib update required labels
1 1 #include "AndroidDeviceLister.h" 2 #define LOG_TAG "VLC/JNI/AndroidDeviceLister" 3 #include "log.h" 2 4 3 5 std::vector<std::tuple<std::string, std::string, bool>> 4 6 AndroidDeviceLister::devices() const 7 9 std::vector<std::tuple<std::string, std::string, bool>> devices; 8 10 devices.reserve( m_devices.size() ); 9 for(auto kv : m_devices) 10 devices.push_back(kv.second); 11 for(auto kv : m_devices) devices.push_back(kv.second); 11 12 return devices; 12 13 } 13 14 14 void 15 bool 15 16 AndroidDeviceLister::addDevice(std::string uuid, std::string path, bool removable) 16 17 { 18 LOGD("addDevice %s %s", uuid.c_str(), path.c_str()); 17 19 std::lock_guard<std::mutex> guard(m_mutex); 18 20 m_devices.insert(std::make_pair(uuid, std::make_tuple(uuid, path, removable))); 21 return p_DeviceListerCb->onDeviceMounted(uuid, path, removable); changed this line in version 5 of the diff
16 17 { 18 LOGD("addDevice %s %s", uuid.c_str(), path.c_str()); 17 19 std::lock_guard<std::mutex> guard(m_mutex); 18 20 m_devices.insert(std::make_pair(uuid, std::make_tuple(uuid, path, removable))); 21 return p_DeviceListerCb->onDeviceMounted(uuid, path, removable); 19 22 } 20 23 21 24 bool 22 AndroidDeviceLister::removeDevice(std::string uuidToRemove) 25 AndroidDeviceLister::removeDevice(std::string uuidToRemove, const std::string& path) 23 26 { 24 27 std::lock_guard<std::mutex> guard(m_mutex); 25 return m_devices.erase(uuidToRemove); 28 auto erased = m_devices.erase(uuidToRemove); 29 p_DeviceListerCb->onDeviceUnmounted(uuidToRemove, path); 30 return erased; I'm surprised this compiles, you're returning an iterator implicitly converted to a boolean.
you probably should check if
erased
is!= m_devices.end()
and only invokeonDeviceUnmounted
thenEdited by Hugo Beauzée-Luyssen
added 14 commits
-
32a762af...0e476d20 - 11 commits from branch
videolan:master
- e6084875 - DeviceLister refactoring for new API
- 1fc2a848 - AndroidDeviceLister: Log addDevice
- 62a33eb3 - Lister fix and start removal
Toggle commit list-
32a762af...0e476d20 - 11 commits from branch
added 17 commits
-
62a33eb3...d588182d - 13 commits from branch
videolan:master
- 7701485e - DeviceLister refactoring for new API
- 6da175a5 - AndroidDeviceLister: Log addDevice
- 5b9d47e9 - Lister fix and start removal
- 3a0584e7 - medialib: Fix inverted logic
Toggle commit list-
62a33eb3...d588182d - 13 commits from branch
added 1 commit
- e7d4e9ee - Medialibrary: Implement new media groups functions
enabled an automatic merge when the pipeline for e7d4e9ee succeeds