[Android] ml: DeviceLister: Fix erroneous std::vector initialization

Hugo Beauzée-Luyssen git at videolan.org
Fri Jan 6 17:07:07 CET 2017


vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Jan  6 17:06:19 2017 +0100| [d8b28adb89cf8e607be233909cbf3343d8be7c87] | committer: Hugo Beauzée-Luyssen

ml: DeviceLister: Fix erroneous std::vector initialization

> https://code.videolan.org/videolan/vlc-android/commit/d8b28adb89cf8e607be233909cbf3343d8be7c87
---

 medialibrary/jni/AndroidDeviceLister.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/medialibrary/jni/AndroidDeviceLister.cpp b/medialibrary/jni/AndroidDeviceLister.cpp
index 5c2f92f..71855bf 100644
--- a/medialibrary/jni/AndroidDeviceLister.cpp
+++ b/medialibrary/jni/AndroidDeviceLister.cpp
@@ -4,7 +4,8 @@ std::vector<std::tuple<std::string, std::string, bool>>
 AndroidDeviceLister::devices() const
 {
     std::lock_guard<std::mutex> guard(m_mutex);
-    std::vector<std::tuple<std::string, std::string, bool>> devices(m_devices.size());
+    std::vector<std::tuple<std::string, std::string, bool>> devices;
+    devices.reserve( m_devices.size() );
     for(auto kv : m_devices)
         devices.push_back(kv.second);
     return devices;



More information about the Android mailing list