comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 1510:ffc9f36103b9

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Aug 2015 10:27:05 +0200
parents 0586ed8897f1
children 33d34bc4ac15
comparison
equal deleted inserted replaced
1509:0586ed8897f1 1510:ffc9f36103b9
347 { 347 {
348 // Not enough results => empty answer 348 // Not enough results => empty answer
349 return; 349 return;
350 } 350 }
351 351
352 std::list<std::string>::iterator start = tmp.begin(); 352 std::list<std::string>::iterator current = tmp.begin();
353 std::advance(start, since); 353 std::advance(current, since);
354 354
355 if (tmp.size() - since <= limit) 355 while (limit > 0 && current != tmp.end())
356 { 356 {
357 tmp.splice(start, target); 357 target.push_back(*current);
358 } 358 --limit;
359 else 359 ++current;
360 {
361 std::list<std::string>::iterator end = start;
362 std::advance(end, limit);
363 tmp.splice(tmp.begin(), target, start, end);
364 } 360 }
365 } 361 }
366 362
367 363
368 364