Skip to content

Commit cec93e4

Browse files
committed
replaces fuzzy_hash std::stoi
1 parent 1ae46fe commit cec93e4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/operators/fuzzy_hash.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ bool FuzzyHash::init(const std::string &param2, std::string *error) {
3838
}
3939
digit.append(std::string(m_param, pos+1));
4040
file.append(std::string(m_param, 0, pos));
41-
try {
42-
m_threshold = std::stoi(digit);
43-
} catch (...) {
41+
const auto conv_res = std::from_chars(digit.data(), digit.data() + digit.size(), m_threshold);
42+
if (conv_res.ec == std::errc::invalid_argument) {
4443
error->assign("Expecting a digit, got: " + digit);
4544
return false;
4645
}

0 commit comments

Comments
 (0)