[Libreoffice-commits] core.git: avmedia/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 22:17:21 UTC 2019


 avmedia/source/viewer/mediawindow_impl.cxx |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit bad6a946b1850a7f9fb4847e0f17b219a90ff200
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Oct 9 23:31:51 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Oct 10 00:15:56 2019 +0200

    Simplify iteration
    
    Change-Id: I0340c47a007e541455d8bf339eaa7d438f5cb10f
    Reviewed-on: https://gerrit.libreoffice.org/80570
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 4aae993d5541..70cc871854d6 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -183,24 +183,22 @@ uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rUR
     {
         return xPlayer;
     }
-    uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
 
     if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON)
     {
+        uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
 
-        static const char * aServiceManagers[] =
+        static OUStringLiteral aServiceManagers[] =
         {
             AVMEDIA_MANAGER_SERVICE_PREFERRED,
             AVMEDIA_MANAGER_SERVICE_NAME,
         };
 
-        for (sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i)
+        for (const auto& rServiceName : aServiceManagers)
         {
-            const OUString aServiceName(aServiceManagers[i],
-                                        strlen( aServiceManagers[i]),
-                                        RTL_TEXTENCODING_ASCII_US);
-
-            xPlayer = createPlayer(rURL, aServiceName, xContext);
+            xPlayer = createPlayer(rURL, rServiceName, xContext);
+            if (xPlayer)
+                break;
         }
     }
 


More information about the Libreoffice-commits mailing list