diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5693:023787ecaff2 find-refactoring

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jul 2024 21:37:20 +0200
parents 708952bd869c
children 380a71e0d7e7
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Jul 11 20:20:50 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Jul 11 21:37:20 2024 +0200
@@ -265,7 +265,8 @@
 
         uint64_t since = boost::lexical_cast<uint64_t>(call.GetArgument("since", ""));
         uint64_t limit = boost::lexical_cast<uint64_t>(call.GetArgument("limit", ""));
-        finder.SetLimits(since, limit);
+        finder.SetLimitsSince(since);
+        finder.SetLimitsCount(limit);
       }
 
       Json::Value answer;
@@ -3347,36 +3348,32 @@
       finder.SetDatabaseLimits(context.GetDatabaseLimits(level));
       finder.SetFormat(OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human));
 
-      size_t limit = 0;
       if (request.isMember(KEY_LIMIT))
       {
-        int tmp = request[KEY_LIMIT].asInt();
+        int64_t tmp = request[KEY_LIMIT].asInt64();
         if (tmp < 0)
         {
           throw OrthancException(ErrorCode_ParameterOutOfRange,
                                  "Field \"" + std::string(KEY_LIMIT) + "\" must be a positive integer");
         }
-
-        limit = static_cast<size_t>(tmp);
+        else
+        {
+          finder.SetLimitsCount(static_cast<uint64_t>(tmp));
+        }
       }
 
-      size_t since = 0;
       if (request.isMember(KEY_SINCE))
       {
-        int tmp = request[KEY_SINCE].asInt();
+        int64_t tmp = request[KEY_SINCE].asInt64();
         if (tmp < 0)
         {
           throw OrthancException(ErrorCode_ParameterOutOfRange,
                                  "Field \"" + std::string(KEY_SINCE) + "\" must be a positive integer");
         }
-
-        since = static_cast<size_t>(tmp);
-      }
-
-      if (request.isMember(KEY_LIMIT) ||
-          request.isMember(KEY_SINCE))
-      {
-        finder.SetLimits(since, limit);
+        else
+        {
+          finder.SetLimitsSince(static_cast<uint64_t>(tmp));
+        }
       }
 
       {