Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestChanges.cpp @ 3560:28ab86c6730e
"/changes": Allow the "limit" argument to be greater than 100
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Nov 2019 07:20:42 +0100 |
parents | 4e43e67f8ecf |
children | 94f4a18a79cc |
comparison
equal
deleted
inserted
replaced
3559:fb759c9efd73 | 3560:28ab86c6730e |
---|---|
43 static void GetSinceAndLimit(int64_t& since, | 43 static void GetSinceAndLimit(int64_t& since, |
44 unsigned int& limit, | 44 unsigned int& limit, |
45 bool& last, | 45 bool& last, |
46 const RestApiGetCall& call) | 46 const RestApiGetCall& call) |
47 { | 47 { |
48 static const unsigned int MAX_RESULTS = 100; | 48 static const unsigned int DEFAULT_LIMIT = 100; |
49 | 49 |
50 if (call.HasArgument("last")) | 50 if (call.HasArgument("last")) |
51 { | 51 { |
52 last = true; | 52 last = true; |
53 return; | 53 return; |
56 last = false; | 56 last = false; |
57 | 57 |
58 try | 58 try |
59 { | 59 { |
60 since = boost::lexical_cast<int64_t>(call.GetArgument("since", "0")); | 60 since = boost::lexical_cast<int64_t>(call.GetArgument("since", "0")); |
61 limit = boost::lexical_cast<unsigned int>(call.GetArgument("limit", "0")); | 61 limit = boost::lexical_cast<unsigned int>(call.GetArgument("limit", boost::lexical_cast<std::string>(DEFAULT_LIMIT))); |
62 } | 62 } |
63 catch (boost::bad_lexical_cast&) | 63 catch (boost::bad_lexical_cast&) |
64 { | 64 { |
65 since = 0; | |
66 limit = DEFAULT_LIMIT; | |
65 return; | 67 return; |
66 } | |
67 | |
68 if (limit == 0 || limit > MAX_RESULTS) | |
69 { | |
70 limit = MAX_RESULTS; | |
71 } | 68 } |
72 } | 69 } |
73 | 70 |
74 static void GetChanges(RestApiGetCall& call) | 71 static void GetChanges(RestApiGetCall& call) |
75 { | 72 { |