changeset 1510:ffc9f36103b9

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Aug 2015 10:27:05 +0200
parents 0586ed8897f1
children 7962563129c9
files Plugins/Engine/OrthancPluginDatabase.cpp
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Aug 10 10:01:59 2015 +0200
+++ b/Plugins/Engine/OrthancPluginDatabase.cpp	Mon Aug 10 10:27:05 2015 +0200
@@ -349,18 +349,14 @@
       return;
     }
 
-    std::list<std::string>::iterator start = tmp.begin();
-    std::advance(start, since);
+    std::list<std::string>::iterator current = tmp.begin();
+    std::advance(current, since);
 
-    if (tmp.size() - since <= limit)
+    while (limit > 0 && current != tmp.end())
     {
-      tmp.splice(start, target);
-    }
-    else
-    {
-      std::list<std::string>::iterator end = start;
-      std::advance(end, limit);
-      tmp.splice(tmp.begin(), target, start, end);
+      target.push_back(*current);
+      --limit;
+      ++current;
     }
   }