desktop/source/lib/init.cxx |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit a36f2d7a66e54e6cc296a565391f8b25396543e3
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Thu Nov 30 01:16:40 2017 +0530

    lok: Replace this custom loop with STL
    
    Change-Id: I3b93654ba3d41733209ff819ca1d0250fb47ce74
    Reviewed-on: https://gerrit.libreoffice.org/45526
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: pranavk <pran...@collabora.co.uk>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0bfa4c7d9317..f58714623fbe 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -13,6 +13,7 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <algorithm>
 #include <memory>
 #include <iostream>
 #include <boost/property_tree/json_parser.hpp>
@@ -2340,24 +2341,19 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
         beans::PropertyValue aValue;
         aValue.Name = "InteractionHandler";
         aValue.Value <<= xInteraction;
-
         aPropertyValuesVector.push_back(aValue);
 
-        // Check if DontSaveIfUnmodified is specified
         bool bDontSaveIfUnmodified = false;
-        auto it = aPropertyValuesVector.begin();
-        while (it != aPropertyValuesVector.end())
-        {
-            if (it->Name == "DontSaveIfUnmodified")
-            {
-                bDontSaveIfUnmodified = it->Value.get<bool>();
-
-                // Also remove this param before handling to core
-                it = aPropertyValuesVector.erase(it);
-            }
-            else
-                it++;
-        }
+        
aPropertyValuesVector.erase(std::remove_if(aPropertyValuesVector.begin(),
+                                                   aPropertyValuesVector.end(),
+                                                   
[&bDontSaveIfUnmodified](const beans::PropertyValue& aItem){
+                                                       if (aItem.Name == 
"DontSaveIfUnmodified")
+                                                       {
+                                                           
bDontSaveIfUnmodified = aItem.Value.get<bool>();
+                                                           return true;
+                                                       }
+                                                       return false;
+                                                   }), 
aPropertyValuesVector.end());
 
         // skip saving and tell the result via UNO_COMMAND_RESULT
         if (bDontSaveIfUnmodified && !pDocSh->IsModified())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to