MCPcopy Create free account
hub / github.com/bcndev/bytecoin / parse_filename

Method parse_filename

src/rpc_api.cpp:110–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110bool api::cnd::SyncBlocks::parse_filename(const std::string &filename, Height *ha) {
111 std::string aa[3];
112 if (!common::split_string(filename, "/", aa[0], aa[1], aa[2]))
113 return false;
114 Height h = 0;
115 try {
116 for (size_t i = 0; i != 3; ++i) {
117 Height part = common::integer_cast<Height>(aa[i]);
118 if (digit3(part) != aa[i])
119 return false; // leading zeros, spaces, etc
120 h = h * 1000 + part;
121 }
122 *ha = h;
123 return true;
124 } catch (const std::exception &) {
125 }
126 return false;
127}
128
129bool api::cnd::SyncBlocks::is_static_redirect(const std::string &body, Height *ha) {
130 try {

Callers

nothing calls this directly

Calls 2

split_stringFunction · 0.85
digit3Function · 0.85

Tested by

no test coverage detected