| 893 | } |
| 894 | |
| 895 | uint64_t GetTabletNumFromName(const std::string& tabletname) { |
| 896 | if (tabletname.size() != TABLET_NAME_LEN || tabletname.substr(0, 6).compare("tablet") != 0) { |
| 897 | return 0; |
| 898 | } |
| 899 | std::string num = tabletname.substr(6, TABLET_NUM_LEN); |
| 900 | |
| 901 | uint64_t v = 0; |
| 902 | uint32_t i = 0; |
| 903 | for (; i < num.size(); i++) { |
| 904 | char c = num[i]; |
| 905 | if (c >= '0' && c <= '9') { |
| 906 | const int delta = (c - '0'); |
| 907 | static const uint64_t kMaxUint64 = ~static_cast<uint64_t>(0); |
| 908 | if (v > kMaxUint64 / 10 || |
| 909 | (v == kMaxUint64 / 10 && static_cast<uint64_t>(delta) > kMaxUint64 % 10)) { |
| 910 | // Overflow |
| 911 | return false; |
| 912 | } |
| 913 | v = (v * 10) + delta; |
| 914 | } else { |
| 915 | break; |
| 916 | } |
| 917 | } |
| 918 | |
| 919 | return v; |
| 920 | } |
| 921 | |
| 922 | void CompareToDiff(std::map<std::string, std::pair<std::string, std::string>>& map_scan, |
| 923 | std::map<std::string, std::vector<std::string>>* map_diff) { |
no test coverage detected