2323namespace crow // NOTE: Already documented in "crow/app.h"
2424{
2525
26- constexpr const uint16_t INVALID_BP_ID{(( uint16_t )- 1 ) };
26+ constexpr const size_t INVALID_BP_ID{SIZE_T_MAX };
2727
2828 namespace detail
2929 {
@@ -729,7 +729,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
729729 {
730730 uint16_t rule_index{};
731731 // Assign the index to the maximum 32 unsigned integer value by default so that any other number (specifically 0) is a valid BP id.
732- uint16_t blueprint_index{INVALID_BP_ID};
732+ size_t blueprint_index{INVALID_BP_ID};
733733 std::string key;
734734 ParamType param = ParamType::MAX; // MAX = No param.
735735 std::vector<Node> children;
@@ -1016,7 +1016,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
10161016 }
10171017
10181018 // This functions assumes any blueprint info passed is valid
1019- void add (const std::string& url, uint16_t rule_index, unsigned bp_prefix_length = 0 , uint16_t blueprint_index = INVALID_BP_ID)
1019+ void add (const std::string& url, uint16_t rule_index, unsigned bp_prefix_length = 0 , size_t blueprint_index = INVALID_BP_ID)
10201020 {
10211021 auto idx = &head_;
10221022
@@ -1301,7 +1301,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
13011301 internal_add_rule_object (rule, ruleObject, INVALID_BP_ID, blueprints_);
13021302 }
13031303
1304- void internal_add_rule_object (const std::string& rule, BaseRule* ruleObject, const uint16_t & BP_index, std::vector<Blueprint*>& blueprints)
1304+ void internal_add_rule_object (const std::string& rule, BaseRule* ruleObject, const size_t & BP_index, std::vector<Blueprint*>& blueprints)
13051305 {
13061306 bool has_trailing_slash = false ;
13071307 std::string rule_without_trailing_slash;
@@ -1316,7 +1316,9 @@ namespace crow // NOTE: Already documented in "crow/app.h"
13161316
13171317 ruleObject->foreach_method ([&](int method) {
13181318 per_methods_[method].rules .emplace_back (ruleObject);
1319- per_methods_[method].trie .add (rule, static_cast <uint16_t >(per_methods_[method].rules .size () - 1 ), BP_index != INVALID_BP_ID ? static_cast <uint16_t >(blueprints[BP_index]->prefix ().length ()) : 0 , BP_index);
1319+ per_methods_[method].trie .add (rule, per_methods_[method].rules .size () - 1 ,
1320+ BP_index != INVALID_BP_ID ? blueprints[BP_index]->prefix ().length () : 0 ,
1321+ BP_index);
13201322
13211323 // directory case:
13221324 // request to '/about' url matches '/about/' rule
0 commit comments